c - how to make "i+=x" works as "i++"? -
the following code
int i=0; while(i<10) { printf("%d\n", i++); }
is equivalent
int i=0; while(i<10) { printf("%d\n", i); i++; }
but following code
int i=0; while(i<10) { printf("%d\n", i+=2); }
is equivalent to
int i=0; while(i<10) { i+=2; printf("%d\n", i); }
how make equivalent
int i=0; while(i<10) { printf("%d\n", i); i+=2; }
the same i++
curious how hard i'll hit suggesting obvious as:
for(int = 0; < 10; += 2) { printf("%d\n", i); }
Comments
Post a Comment