Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What is the difference between declaration and definition?

Answers were Sorted based on User's Feedback



What is the difference between declaration and definition?..

Answer / roshan

During declaration we just specify the type and no memory
is allocated to the variable. But during the definition an
initial value is assigned and memory is allocated to the
variable.

Is This Answer Correct ?    186 Yes 33 No

What is the difference between declaration and definition?..

Answer / s

Declaration means we are just creating a variable or method.
Defination means we are assigning some value for a variable
& doing some functions in method

Is This Answer Correct ?    116 Yes 48 No

What is the difference between declaration and definition?..

Answer / sanjay

The definition is the one that actually allocates space,
and provides an initialization value, if any.
There can be many declarations, but there must be exactly
one definition. A definition tells the compiler to set
aside storage for the variable. A declaration makes the
variable known to parts of the program that may wish to use
it. A variable might be defined and declared in the same
statement

Is This Answer Correct ?    57 Yes 5 No

What is the difference between declaration and definition?..

Answer / 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

What is the difference between declaration and definition?..

Answer / omkar

Declaration means just telling to complier about variable
or function but definition means actually allocating memory
for variable.

Is This Answer Correct ?    28 Yes 6 No

What is the difference between declaration and definition?..

Answer / sachin bhosale

Declaration Mean You just Declare a variable and Function
their is No Allocation of Memory.But In Defination Actual
use of use declare Variable and Function Assing the value
with accupy Memory as Per their Type.

Is This Answer Correct ?    12 Yes 6 No

What is the difference between declaration and definition?..

Answer / krishna chowdary garapati

Declaration means it exits but it has no meaning. But where
as definition means it has a meaning. Without decalration
there is no definition. Why means without existing how can
we use.
Some situations we do both in a single statement like,
int i = 10;
here i is declared and definie with the value 10;
But some languages give some value to the variable without
defining like
class DiffsDemo {
int i;
}

DiffsDemo demo = new DiffsDemo();
print: demo.i;
output: 0;

This will happen because some default values are assigned
to that types. Internally at run time they will define.

Is This Answer Correct ?    10 Yes 5 No

What is the difference between declaration and definition?..

Answer / friend nitk

The declaration tells the compiler that at some later point
we plan to present the definition of this declaration.
E.g.: void stars () //function declaration
The definition contains the actual implementation.
E.g.: void stars () // declarator
{
for(int j=10; j > =0; j--) //function body
cout << *;
cout << endl; }

Is This Answer Correct ?    7 Yes 2 No

What is the difference between declaration and definition?..

Answer / ganesh9948302505

Declaration of a function is COMPILATION PHASE,inorder to
support the SIGNATURE OF FUNCTION like function
name,arguments. Simply it identifies FUNCTION.

Where as in defination, function cotains SET OF
STATEMENTS and expands SOURCE CODE in the form of
instructions
(all this is concept of functions)

Is This Answer Correct ?    5 Yes 1 No

What is the difference between declaration and definition?..

Answer / 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

More OOPS Interview Questions

What is static modifier?

0 Answers  


is java purely oop Language?

49 Answers   HCL, Infosys, TCS,


How do you make derived class as an abstract class?

1 Answers   Convergys, TCS,


WAP to generate 2n+1 lines of the following pattern on the computer screen:

2 Answers  


What is difference between multiple inheritance and multilevel inheritance?

0 Answers  


what is the use of template classes in c++

1 Answers  


if u write a class do u write Assignment operator and copy constructor

1 Answers   Siemens,


write a code for this:trailer recordId contains a value other than 99, then the file must error with the reason ‘Invalid RECORD_ID’(User Defined Exception).

0 Answers  


Is data hiding and abstraction same?

0 Answers  


What is the full form of oops?

0 Answers  


tell about copy constructor

3 Answers   Siemens,


How to calculate the age from the date of birth by using the program?

2 Answers   Accenture,


Categories