Sail E0 Webinar
Question

In the following program where is the variable a getting defined and where is it getting declared ?


#include<stdio.h>
int main()
{
extern int a;
printf("%d\n", a);
return 0;
}
int a=20;


Options:
A .  extern int a : Declaration, extern int a : Defined
B .  int a = 20 : Declaration, extern int a : Defined
C .  extern int a : Declaration, int a = 20 : Defined
D .  int a = 20 : Declaration, int a = 20 : Defined
Answer: Option C

extern int a is the declaration whereas int a = 20 is the definition




Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers