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
What are the two different types of polymorphism?
Can bst contain duplicates?
i am getting an of the type can not convert int to int *. to overcome this problem what we should do?
What is the example of polymorphism?
What is overriding in oop?
Is enum a class?
What is class and object in oops?
i=20;k=0;
for(j=1;k-i;k+=j<10?4:3)
{
cout< What is coupling in oop? What is encapsulation in oop? What polymorphism means? What is encapsulation in oops? Can we create object of abstract class? What is static in oop? Can abstract class have normal methods?