0%

day9

C primer plus

++i with i++

1
2
3
4
5
6
7
8
9
10
11
12
#include<stdio.h>
int main ()
{
int a = 1 , b = 1 ;
int a1 ,b1 ;
a1 = a++;
b1 = ++b;
printf("a a1 b b1 \n");
printf("%1d %2d %1d %2d\n",a,a1,b,b1);

return 0 ;
}
1
2
a a1 b b1 
2 1 2 2

When n++ is part of an expression, you can think of it as meaning “use n ; then increment it.” On the other hand, ++n means “increment n ; then use it.”

------------- The end -------------

Welcome to my other publishing channels