What is the difference between declaration and definition?
Answer Posted / rajesh manem
Ans: The declaration is means the memory is not yet all to
be allocated..
For example:
Int a; //is it declaration? Or definition?
Just check this
Int main()
{
Int I;
Printf(ā%dā,i);
}
It prints the garbage value that means the memory is
allocated for this declaration so we can say that this int I
is both declaration and definition.
And take another example extern int I -- declaration
because no memory is allocated.
Similarly for function prototypes all are declarations.
In the case of class declaration String s; // Declaration
[because reference is created]
When the new keyweord encounters then it is definition
String *s=new Stirng(); //declaration and
definition
| Is This Answer Correct ? | 38 Yes | 4 No |
Post New Answer View All Answers
Please send ford technologies placement paper 2 my mail id
Is enum a class?
What are oops methods?
What is methods in oop?
What is pure oop?
Can bst contain duplicates?
What is destructor in oop?
How is polymorphism achieved?
What is a null tree?
What is object in oop?
Where is pseudocode used?
How do you define social class?
How to improve object oriented design skills?
is there any choice in opting subjects like 4 out of 7
explain sub-type and sub class? atleast u have differ it into 4 points?