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
i am getting an of the type can not convert int to int *. to overcome this problem what we should do?
write a C++ program for booking using constructor and destructor.
Templates mean
Describe these concepts: Polymorphism, Inheritance and Abstraction.
What are the advantages of polymorphism?
What is coupling in oops?
What is oops?what is its use in software engineering?
What is methods in oop?
Why is abstraction used?
i got a backdoor offer in process global,Bangalore..Can i work with it?
Explain virtual inheritance?
What is polymorphism and types?
How many human genes are polymorphic?
What is the fundamental idea of oop?
Why do we use oops?