H
hari4063
Every day I prove that i am beginer with C (even I program in C or/and C++
for more than 5 years)! Some days ago I find code that use _REALY_ strange
sintax, something like this:
// ------- code ------
int a[10];
int i;
for(i=0; i<10; i++)
i[a] = i;
// --- end ------------
At first I think that is some compiler specific _hack_, but i find
something that is called "array comutation"? So, using a is same like
*((a)+(i)). With this, upper code have (just little bit) logic.
My questiona are:
1) is this portable
2) is this truely what C creators wanna to have, or just parser use this
becuase *(a+i) rule?
Thanks.
for more than 5 years)! Some days ago I find code that use _REALY_ strange
sintax, something like this:
// ------- code ------
int a[10];
int i;
for(i=0; i<10; i++)
i[a] = i;
// --- end ------------
At first I think that is some compiler specific _hack_, but i find
something that is called "array comutation"? So, using a is same like
*((a)+(i)). With this, upper code have (just little bit) logic.
My questiona are:
1) is this portable
2) is this truely what C creators wanna to have, or just parser use this
becuase *(a+i) rule?
Thanks.