Declare in C == define in C++?

Possible Duplicate:
What is the difference between a definition and a declaration?

Is it correct that to declare in C is equal to define in C++?

int a;     /* to declare variabel a in C */
int b = 2; /* to declare and initialize in C */


int c;     // to define in C++ 
int d = 4; // to define and initialize in C++ 

No.

For functions, I've seen "declare" being used for just writing the header, whereas "define" was used for writing the body.

However, it's all natural language. "declare" as in you C example seems correct for both C and C++.


In C, declaring means to tell the compiler it exists whereas defining is assigning an actual value to it.

I see no reason why this would be different in C++


是的,它应该是

链接地址: http://www.djcxy.com/p/40624.html

上一篇: 它是一个定义还是一个声明?

下一篇: 在C ++中声明C == define?