Declare in C == define in C ++?

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

Is it correct that the declaration in C is equal to the one specified 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++ 
+4
source share
3 answers

Not.

For functions, I saw that "declare" is used to write the header, while "define" is used to write the body.

However, this is all natural language. "declare" as you have Example C seems to be correct for C and C ++.

+2
source

In C, a declaration means to tell the compiler what exists, while a definition assigns it an actual value.

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

+1
source

yes it should be

0
source

Source: https://habr.com/ru/post/1299314/


All Articles