
- Forum
- Programming Talk
- C and C++
- Incrementation and decrementation in C
Incrementation and decrementation in C
This is a discussion on Incrementation and decrementation in C within the C and C++ forums, part of the Programming Talk category; #include<stdio.h> int main(){ int a=5; printf("%d %d %d",a++,a++,++a); return 0; } i tried this code in Visual C++ 2008 and ...
-
Incrementation and decrementation in C
#include<stdio.h>
int main(){
int a=5;
printf("%d %d %d",a++,a++,++a);
return 0;
}
i tried this code in Visual C++ 2008 and i have get 7 6 8 as output.
can anyone describe the fact around the output is'nt being 5,6,8.
-
Please do not try to modify the values of your variables more than once in a single function call argument-list because the order of evaluation of operands of individual operators and sub-expressions of individual expressions, and the order in which side effects take place, is unspecified.
Please try to read more on these topics "Sequence Points" and "Undefined Behavior"

Reply With Quote





