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
Get me an image implementation program.
What is the real life example of polymorphism?
What is object in oops?
What are benefits of oop?
What is the fundamental idea of oop?
Why is abstraction needed?
What is multilevel inheritance explain with example?
#include
What is polymorphism explain?
when to use 'mutable' keyword and when to use 'const cast' in c++
Can an interface inherit a class?
#include
Write a program to implement OOPS concepts such as inheritance, polymorphism, friend function, operator overloading?
Which language is pure oop?
Why is polymorphism used?