C | Operators | Question 7
#include <stdio.h> int main() { int i = 5, j = 10, k = 15; printf("%d ", sizeof(k /= i + j)); printf("%d", k); return 0; } |
chevron_right
filter_none
Assume size of an integer as 4 bytes. What is the output of above program?
(A) 4 1
(B) 4 15
(C) 2 1
(D) Compile-time error
Answer: (B)
Explanation: The main theme of the program lies here: sizeof(k /= i + j). An expression doesn’t get evaluated inside sizeof operator. sizeof operator returns sizeof(int) because the result of expression will be an integer. As the expression is not evaluated, value of k will not be changed.
Quiz of this Question
Recommended Posts:
- Operators in C | Set 2 (Relational and Logical Operators)
- C | Operators | Question 2
- C | Operators | Question 6
- C | Operators | Question 5
- C | Operators | Question 16
- C | Operators | Question 26
- C | Operators | Question 18
- C | Operators | Question 22
- C | Operators | Question 17
- C | Operators | Question 15
- C | Operators | Question 23
- C | Operators | Question 11
- C | Operators | Question 12
- C | Operators | Question 13
- C | Operators | Question 27


