/* i is a pointer to an int, and has not been given a valid address yet */
/* i_len is an int, and has been assigned the value of zero */
/* i_len is an int still, and has been incremented to 1. i_len is being used as an
index in an array, but i has not yet been given memory space. This is an error,
and the results are undefined. If it's kept up. It will crash the program.
The place in memory that is one int past i in memory, has been assigned the
value of one, although the pointer i doesn't own this memory location.
/* Same as above, except one more int's size up from the space i is pointing to.
This is undefined, and may cause anything to happen, from a program crash, to
a wrong answer, to nothing noticeable.
The more it's continued, the more likely the "anything" will be more severe.
There is a close relationship between pointers and arrays, in C. i is a pointer, but not an array, and has been given no memory ("real estate") of it's own. It is a "squatter", if you will.
In the above scenerio, does it mean 'i' is being set as a pointer to 1 dimensional array, which sets 1,2 one after another sequentially into the array? The coder later pass the 'i_len' value as return from function. I understand 'i_len' is just an array index but could it mean something else?
If i were allocated (given) some memory, ( with malloc() or calloc() )it could be used as a "dynamic" array - which is *VERY* close (but never quite the same thing), as a "real array".
int *i; //a pointer, which could be allocated memory, and become a "dynamic" array.
int i; //a real array