void main()
{
int a=10,b;
b=(a++)+(a++);
a=(b++)+(b++);
printf(“a=%d and b=%d”,a,b);
}
acc to me
b=(a++)+(a++);
=10+11=21 and a=22;
now
a=(b++)+(b++);
=21+22=43 and b=23;
therefore,a=43 and b=23;
is this method of solving is correct???
what will be output for ?
void main()
{
int a = 3;
int b = ++a + a++ + --a;
printf("Value of b is %d", b);
}
using above strategy resulting wrong output?