View Single Post
Newbie Member
30Jan2008,11:00  
humhaingaurav's Avatar
#include <stdio.h>

void f(int a, int b) { printf("%d %d\n", a, b); }

int main() {
int a;
a = 1; printf("Pre: f(++a, a) --> "); f(++a, a);
a = 1; printf(" f(a, ++a) --> "); f(a, ++a);
a = 1; printf("Post: f(a++, a) --> "); f(a++, a);
a = 1; printf(" f(a, a++) --> "); f(a, a++);
}
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
:!./a.out
Pre: f(++a, a) --> 2 2
f(a, ++a) --> 2 2
Post: f(a++, a) --> 1 2
f(a, a++) --> 2 1

Press ENTER or type command to continue


-------------------------------------------------------------------------------------------------
See dude my compiler is still giving different output then yours. Well, I am using UNIX machine I don't know if that matters. But oh well here is the output from my system .