![]() |
|
#1
|
|||
|
|||
arrays in csay i have an array with the following elements set: a[2] = 1, a[5] = 4, a[7] = 2. i want to go thru all its elements and print them on the screen (or whatever). i know c has 'foreach', but the c installation that i have to use does not have 'contain.h' (i think 'foreach' is from that lib). could you offer a solution .. how to go thru all array elements if there are gaps in the indexing. thank you.
|
|||
|
#2
|
|||
|
|||
|
As far as I know every variable holds some value, wether you want it or not.. I you have not refered to this wariable jet the value it may hold can be very unpredictable - some address of the memory and such..
one solution to your problem could be for example to give all elements of array spesific values before using it, so afterwards those elements you have used will hold diferent value.. For example: CPP / C++ / C Code:
|
Recent GIDBlog
Problems with the Navy (Officers) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Extra null element in an array | samtediou | MySQL / PHP Forum | 2 | 11-Dec-2003 11:52 |
| Arrays | Andrew | MySQL / PHP Forum | 2 | 26-Jan-2003 02:50 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The