Recently I faced an issue understanding the behaviour for printf()
function.
This is what I was working with
#include<stdio.h>
int main(){
int a=5;
printf("%d %d %d",a++,a++,++a);
return 0;
}
When I ran this code snippet on gcc (linux) I got output as 7 6 8
.
But while running it on turbo (windows) I got output as 7 6 6
.
What I understood is in turbo the parameters are passed in right to left order.
Can anyone explain how it works in linux using gcc.