A declaration introduces an identifier and describes its type, be it a type, object, or function. A declaration is what the compiler needs to accept references to that identifier.
A definition actually instantiates/implements this identifier. It's what the linker needs in order to link references to those entities.
The declaration tells the compiler that at some later point we plan to present the definition of this declaration.
E.g.:
void stars () //function declaration The definition contains the actual implementation. E.g.: void stars () // declarator { for(int j=10; j > =0; j--) //function body cout << *; cout << endl; }
Liked By
Write Answer
What is the difference between declaration and definition?
Join MindStick Community
You have need login or register for voting of answers or question.
Anonymous User
15-Jan-2015E.g.: