I am trying to execute the following C code:
#include <stdio.h>
int a = 5;
int fun1(){
a = 17;
return 3;
}
int main(){
int b;
b = a + fun1();
printf("%d\n", b);
}
When I run it on my macbook, I get a response from 8, but when I run it on Linux, I get a response of 20. I had several friends who ran it, and everyone with a Mac gets 8, and all Linux starts getting 20 What can cause this?
I am not so interested in the correct answer, because I am in the reason that the two environments give different answers. What about OS X and Linux cause mismatch?
source
share