What is the difference between declaration and definition?

Answer Posted / durga devi sathi

Declaration of a variable means name the variable and tells
compiler that this has been present elsewhere in the program
Definition means that allocate or reserve some space and
store the value in that variable.
the variables like auto and registers, the declaration and
definition done at the same time because they are named the
variable and allocate the memory at the same time.
Ex- int a;//declaration and definition
extern int a;//only declaration
once the variable is defined it is ready to hold the data
value needed by the program

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the benefit of oop?

570


Can a varargs method be overloaded?

618


What is encapsulation in oop?

610


What is the significance of classes in oop?

590


When not to use object oriented programming?

572






What is overriding vs overloading?

589


State what is encapsulation and friend function?

702


What is overloading in oops?

598


What are the benefits of interface?

583


What is basic concept of oop?

702


What is the renewal class?

2171


IS IT NECESSARY TO INITIALIZE VARIABLE? WHAT IF THE INSTANCE VARIABLE IS DECLARED final ? IS IT NECESSARY TO INITIALIZE THE final VARIABLE AT THE TIME OF THEIR DECLARATION?

1584


Prepare me a program for the animation of train

2003


Is data hiding and abstraction same?

570


Which method cannot be overridden?

584