Originally Posted by
BIOS
Hey thanks for the reply!
That makes perfect sense. Thanks for the explanation. I think it was the fact that you can place the increment operator as a prefix in C that threw me. I.e. in Java you would write:
C has both prefix and postfix in this case... The difference being this...
Code:
int myarray[4] = {1,2,3,4}
x = ++myarray[2]; // x = 4, myarray[2] = 4
x = myarray[2]++; // x =3, myarray[2] = 4
The difference is whether myarray[2] is incremented before the assignment or after...
Also let me toss in just a small note of caution here... Beware of comparing languages! ... Java does a lot of babysitting that C does not, it also has features C does not. C gives you control over code that is hidden in Java, it can also do some stuff Java cannot... Whenever possible, you should treat your C learning experience as something entirely new and different...