Arp*_*pit 0 c++ program-entry-point
为什么此代码打印1而不是5
码:
main(int x=5) //this defn. is written intentionally to chec weather main accepts
expression or not.
{
printf("%d",x);
}
Run Code Online (Sandbox Code Playgroud)
编译使用:minGW 3.2
编辑
我的观点是天气x=5执行与否.如果没有那么为什么我没有得到任何错误或警告.
Kev*_*imm 10
因为x实际上是argc(并且你的参数计数是1)
main的签名是:
int main (int argc, char **argv)
Run Code Online (Sandbox Code Playgroud)
argc是参数计数,
argv是这些参数的数组