how is 1st code working to get 21 while when same value is assigned to **b** the post increment operator doesn't work?

29 views Asked by At

when running the below code the output is 21

#include<stdio.h>
int main()
{int a=10,b=10;

printf("%d",a+(a++));

}

whereas running below code gives output 20

int main()
{int a=10,b=10;

printf("%d",b+(a++));

}

how is 1st code working to get 21 while when same value is assigned to b the post increment operator doesn't work?? (10+10++) in case of a it will work as 10+10=20 then ads 1 and shows the value where as in case of b it will only do 10+10=20 and shows the value. why? is it showing this?

0

There are 0 answers