i++ : Assign then increment
++i : increment then Assign
//Remember that the values are i = 10, and j = 10
i is 10
i++ is 10 //Assigns (print out), then increments
i is 11
j is 10
++j is 11 //Increments, then assigns (print out)
j is 11
#include <stdio.h>
int main() {
int i=5,j;
j=i++;
printf ("
after postfix increment i=%d j=%d", i,j);
i=5;
j=++i;
printf ("
after prefix increment i=%d j=%d",i,j);
return 0;
}
//output:
//after postfix increment i=6 j=5
// after prefix increment i=6 j=6
let x = 10;
while(x < 20) { //when x is less than 20
x++; //add 1 to x
console.log(x); //logs the numbers 11 - 20 to the console
}
int i = 10, j = 10;
printf ("i is %i
", i);
printf ("i++ is %i
", i++);
printf ("i is %i
", i);
printf ("j is %i
", j);
printf ("++j is %i
", ++j);
printf ("j is %i
", j);