In pre-increment, first the value of the variable is incremented after that the assignment or other operations are carried
#include <stdio.h>
int main()
{
int a = 11 ,b;
b = ++a;
printf("b = %d\n\n", b);
printf("a = %d\n", a);
return 0;
}
Output
b = 12
a = 12
Here first the value of a increments and then is assigned to variable b. So both a and b value will be 11.
Top comments (0)