这道题为什么这样使用p却没有报错

  1. What is the output of this C code?

  2. #include

  3. struct

  4. {

  5.    int k;
    
  6.    char c;
    
  7. } p;

  8. int p = 10;

  9. int main()

  10. {

  11.    p.k = 10;
    
  12.    printf("%d %d\n", p.k, p);
    
  13. }

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 当然编译错误了。。。