Problem: Output of this C Code
{
int a = 1;
int c,d;
c = ++a + ++a + ++a;
printf("\n%d",a);
printf("\n%d ", c);
getch();
}
The above C code after the execution gives the values of 'a' and 'c' as '4' and '12' resp.
Can anyone explain, why it is so...
Member • Apr 16, 2007
Member • Apr 26, 2007
Member • Apr 27, 2007
Member • May 2, 2007
Member • May 16, 2007
SujathaHi Mahesh,
Whatever u have explained is correct. I have executed the same program in LINUX and i ot the answer as '4 ' and '10 'for 'a' and 'c' respectively.Yes its behaviour is compiler dependent.
Hi Chowdary!!!!!!!!
I think ur from AP. Its nice to see in this forum. Looking forward to share more knowledge.
Cheers
Sujatha
Member • May 17, 2007