这是我的第一个问题,很高兴认识你!有人可以解释为什么这个代码用C编写
#include <stdio.h>
int main(){
int choice;
printf("\nSize of 'choice' %d\n", sizeof(choice));
printf("Size of 'int' %d\n", sizeof(int));
printf("Value of 'choice %d\n", choice);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
在Windows上使用gcc -o C:\test.exe test.c(gcc版本2015/06/27)编译返回这些值
Size of 'choice' 4
Size of 'int' 4
Value of 'choice 2
Run Code Online (Sandbox Code Playgroud)
在Linux上,一切都按照我的预期运行,返回这些值
Size of 'choice' 4
Size of 'int' 4
Value of 'choice 0
Run Code Online (Sandbox Code Playgroud)
我错过了什么?
非常感谢.