hi i am getting different answers for the same code in VC++ and
TURBOC++
The source code is as follows
What is the clarification i can get.Code:void main()
{
int a=1;
printf("%d",++a + ++a);
}
thanking you very much.
Printable View
hi i am getting different answers for the same code in VC++ and
TURBOC++
The source code is as follows
What is the clarification i can get.Code:void main()
{
int a=1;
printf("%d",++a + ++a);
}
thanking you very much.
http://c-faq.com/expr/index.html
Your code is broken in more ways than there are lines of code, so what you get is entirely random and nothing to do with C.
The output is 4.Code:int main()
{
int a=1;
printf("%d", 2 * (a + 1));
return 0;
}
Note: This program is C, not C++ (but you can compile it in a c++ compiler)
EDIT: Salem speaks the truth.
. . . assuming you include stdio.h, of course.