The first code is :
#include <stdio.h>
int main() {
int a,b,c;
a = 4;
b = ++a;
c = b + a++;
printf("%d",c);
return 0;
}
Output is 10
The second code is :
#include <stdio.h>
int main() {
int a,b;
a = 4;
b = ++a + a++;
printf("%d",b);
return 0;
}
The output is 11
The two codes should give 10 as the output I believe. Am I doing anything wrong? Can someone explain the above two scenarios?