这是一个非常快速的问题。 我为什么允许这样做:字符指针数组赋值
char* sentence[2] ={"blahblah","trololo"};
int main() {
printf("%s",sentence[0]);
printf("%s",sentence[1]);
return 0;
}
但不是这个?:
char* sentence[2];
sentence[0] = "blahblah";
sentence[1] = "trololo";
int main() {
printf("%s",sentence[0]);
printf("%s",sentence[1]);
return 0;
}
请考虑是否有多个源文件,每个源文件都包含代码* outside *以外的函数。当你将它们编译在一起时,你会期望所有代码执行的时间(以及以何种顺序)? – dreamlax