C | Variable Declaration and Scope | Question 3
#include <stdio.h> extern int var; int main() { var = 10; printf ( "%d " , var); return 0; } |
chevron_right
filter_none
(A) Compiler Error: var is not defined
(B) 20
(C) 0
Answer: (A)
Explanation: var is only declared and not defined (no memory allocated for it)
Refer: Understanding “extern” keyword in C
Quiz of this Question
Attention reader! Don’t stop learning now. Get hold of all the important C++ Foundation and STL concepts with the C++ Foundation and STL courses at a student-friendly price and become industry ready.