void call(int x,int y,int z)
{
printf("%d %d %d",x,y,z);
}
int main()
{
int a=10;
call(a,a++,++a);
return 0;
}
this program is giving different output on different compiler and when i compiled it on linux m/c output was quite weird,any reason.
Because the behaviour is undefined. The compiler is allowed to evaluate
a,a++and++ain any order before passing them tocall(). (Technically, because we’ve invoked undefined behaviour, it actually doesn’t have to do anything in particular at this point; it may write whatever code it pleases.) Depending on what order they’re evaluated in, the results differ.