In the following program where is the variable a getting defined and where it is getting declared? #include<stdio.h> int main() { extern int a; printf("%d\n", a); return 0; } int a=20;

Review the verified answer and explanation for this DemoPaper-Pakistan past-paper question on CampusFin.

In the following program where is the variable a getting defined and where it is getting declared? #include<stdio.h> int main() { extern int a; printf("%d\n", a); return 0; } int a=20; Answer: extern int a is declaration, int a = 20 is the definition

- During declaration we tell the datatype of the Variable. - During definition the value is initialized.

Question context

This question is part of 💡 C Programming within the broader 💻 Programming subject and appears in the DemoPaper-Pakistan preparation collection. Reviewing the answer together with nearby questions helps reinforce the underlying concept and identify how it may appear in competitive exams.