Sunday, July 12, 2009

C programming?

in a for loop does it ever matter if the update statement is


++i instead of i++





like


for(i=0; i%26lt;3; ++1)

C programming?
If you put the increase operator (++) in the front of the variable, if just means that the value is increased before the result value.





For example:


int x = 42;


int y = x++


y would have the value 42





whereas in this case:


int x = 42;


int y = ++x;


y would have the value 43





However in your case, it would not matter. Since int i would become the same value regardless if you placed the increase operator in the front or back.





Hope this helps.


No comments:

Post a Comment