PREDICT THE OUTPUT FOR THE CODE
void main()
{
int a=1;
printf(“%d%d%d”,a++,++a,a);
}
ur predicted output 1 3 3 is wrong,then…..
OUTPUT:
2 2 1
this is because control in printf statement travels from right to left and not from left to right
hence first ‘a’ is computed then ‘++a’ and then ‘a++’ and printed in the order u have specified
got it..
Categories: C PROGRAMMING
PROGRAMMING
feedback