Hey all,
First post here and hello to everyone.
I've been studying C for a few months now, and everythnig has been making sense and I'm enjoying the challenge of learning to progeam.
Ther is one thing that keeps eluding my understanding of arrays, and that's using a variable in a for loop such as this:
#include <stdio.h>
int main()
{
int array[10];
int i;
for (i = 0; i < 10; ++i){
array[i]=i;
printf("%d\n", array[i]);
}
return 0;
}
No matter how I look at this, I can't seem to grasp the function of the variable i in this bit of the code, array. I can see that the loop runs up to 9, that the value of i is being assigned to each element in the array as the loop runs, that the variable i is being used as the index for the array, but why is the i in the array part?
Apologies if this is so basic, but it's driving me mad. Strange thing is, I find pointers to be easier to grasp tham this one thing. lol
Cheers.