Examveda
Examveda

What is the difference between a declaration and a definition of a variable?

A. Both can occur multiple times, but a declaration must occur first.

B. A definition occurs once, but a declaration may occur many times.

C. Both can occur multiple times, but a definition must occur first.

D. A declaration occurs once, but a definition may occur many times.

E. There is no difference between them.

Answer: Option D


This Question Belongs to C Program >> C Fundamentals

Join The Discussion

Comments ( 14 )

  1. Sanjay Tiwari
    Sanjay Tiwari :
    2 years ago

    Correct ans is D
    Int ino;
    ino =10;
    ino. =20;

  2. Chethan Kumar
    Chethan Kumar :
    2 years ago

    A variable or function can be declaired many no of times, a defination can be define one time.

  3. Kshitiz Saxena
    Kshitiz Saxena :
    3 years ago

    Yes ! The answer given is incorrect. The correct answer is Option B

  4. Your Ssc
    Your Ssc :
    3 years ago

    What is definition

  5. Nisha Nik
    Nisha Nik :
    3 years ago

    The declaration could be done multiple times either of a variable or of function.
    Variable or function could be defined only once.
    Its wrong

  6. VISHNU Maram
    VISHNU Maram :
    4 years ago

    int main()
    {
    int a;
    a=10;
    {
    int a;
    a=1000;
    printf("%d",a);
    }
    printf("% d",a);
    }

    o/p
    1000 10

  7. VISHNU Maram
    VISHNU Maram :
    4 years ago

    void main()
    {

  8. Archita Asthana
    Archita Asthana :
    6 years ago

    ans is b not d
    declaration can be done many time but defination only once

  9. Palagati Deepthi
    Palagati Deepthi :
    6 years ago

    answer for above question is B not D

  10. Pratik Shete
    Pratik Shete :
    6 years ago

    thanks madhura and ayesha!

  11. Gourav Garg
    Gourav Garg :
    7 years ago

    A declaration occurs once,but a definition may occur many times.Explain,I cannot understand this.

  12. Madura Rajapakshe
    Madura Rajapakshe :
    7 years ago

    Declaration of variable mean to tell compiler their is a varfunctstruct of particular data type. Definition of variable mean asking compiler to allocate memory to variable or define storage for that variable. you can define a variable only one time but you can declare it as many time you want.

  13. Ayesha Pathan
    Ayesha Pathan :
    7 years ago

    intially we declare the variable then we use dafination

  14. Movie Mania
    Movie Mania :
    8 years ago

    plz explain

Related Questions on C Fundamentals