What is the output of this C code?
#include
struct
{
int k;
char c;
} p;
int p = 10;
int main()
{
p.k = 10;
printf("%d %d\n", p.k, p);
}
a) Compile time error
b) 10 10
c) Depends on the standard
d) Depends on the compiler
View Answer
Answer:a
答案是A, 不就是说编译时错误么??
选a,编译错误
http://codepad.org/zZ7TYrju
error: conflicting declaration 'int p'
结构体 和 int 同时定义 p 当然编译错误了。。。