+ 1
How Do I store more than one item on the same Index If one array?
Ok, I have one array, but in my code to the same Index If that array, I have 50 values for to that same Index, but when I try to generate one file with all that information, the file have only the last information, and discart all 49. https://code.sololearn.com/c04UTMr60iHq/?ref=app
3 odpowiedzi
+ 7
Each index stores one number. If you 'add' another one, you are really overwriting the former value.
If you want to store many values per index, you can use a twodimensional array.
int numbers[10][50];
This creates an array with ten sub-arrays for 50 numbers.
Then you can access each element of one of the arrays by double index.
printf("%d", numbers[4][49]);
This prints the 50th number of the 5th array.
+ 1
Thanks man ❤️❤️❤️, this really help me.
0
Man, How I do generate this in a file?