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

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

css - Text drops down with smaller window -