Is “int a;” a declaration or definition in C and in C++?

后端 未结 3 1307
情深已故
情深已故 2020-12-30 09:44

Is int a; a declaration or definition in C? Is there any difference in C++?

I was always thinking it\'s just a declaration, until today...

Is i

3条回答
  •  悲&欢浪女
    2020-12-30 10:22

    Where does it appear in your program?

    In most contexts, it is both a declaration and definition.

    OTOH, extern int a; is a declaration only.

提交回复
热议问题