What is the difference between declaration and definition?

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the types of abstraction?

558


Can an interface inherit a class?

564


Which language is pure oop?

551


write a program using c++ to implement single contiguous memory mangement techniques.display the content of the main memory after yhe allocation of jobs and percentage of the wastage of the main memory

2763


What is a null tree?

632






What is abstraction encapsulation?

658


How to use CMutex, CSemaphore in VC++ MFC

4333


Why is object oriented programming so hard?

616


What is a class oop?

594


What is abstraction and encapsulation?

575


Which is better struts or spring?

624


What is difference between pop and oop?

609


What does <> mean pseudocode?

624


Write a program to sort the number with different sorts in one program ??

1921


Describe these concepts: Polymorphism, Inheritance and Abstraction.

615