Declare in C == define in C++? [duplicate]
Possible Duplicate:
What is the difference between a definition and a declaration? 开发者_JS百科
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++
yes it should be
精彩评论