C | Variable Declaration and Scope | Question 7
int main() { int x = 032; printf("%d", x); return 0; } |
chevron_right
filter_none
(A) 32
(B) 0
(C) 26
(D) 50
Answer: (C)
Explanation: When a constant value starts with 0, it is considered as octal number. Therefore the value of x is 3*8 + 2 = 26
Quiz of this Question
Recommended Posts:
- C | Variable Declaration and Scope | Question 1
- C | Variable Declaration and Scope | Question 2
- C | Variable Declaration and Scope | Question 3
- C | Variable Declaration and Scope | Question 4
- C | Variable Declaration and Scope | Question 5
- C | Variable Declaration and Scope | Question 8
- C | Variable Declaration and Scope | Question 6
- 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?
- Different ways to initialize a variable in C/C++
- Redeclaration of global variable in C



