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
Recommended Posts:
- C | Variable Declaration and Scope | Question 2
- C | Variable Declaration and Scope | Question 7
- C | Variable Declaration and Scope | Question 8
- C | Variable Declaration and Scope | Question 1
- C | Variable Declaration and Scope | Question 5
- C | Variable Declaration and Scope | Question 6
- C | Variable Declaration and Scope | Question 4
- Can we access global variable if there is a local variable with same name?
- Scope rules in C
- What happens when a function is called before its declaration in C?
- Scope Resolution Operator Versus this pointer in C++?
- What is the difference between single quoted and double quoted declaration of char array?
- How to print a variable name in C?
- Why variable name does not start with numbers in C ?
- Variable Length Argument in C



