Question:
In C, what is the output of printf("%d", sizeof('A')); on a standard 32-bit/64-bit GCC compiler?
मानक 32-बिट/64-बिट GCC कंपाइलर पर C भाषा में printf("%d", sizeof('A')); का आउटपुट क्या होगा?
Options:
- 4
- 1
- 2
- 8
- 4
- 1
- 2
- 8
Correct Answer: a)
Explanation:
In C, character constants like `’A’` have type `int` (integer character constant), so `sizeof(‘A’) == sizeof(int) == 4` bytes. (In C++, its type is `char`, which gives 1) (Option a).
C भाषा में कैरेक्टर स्थिरांक (जैसे ‘A’) का प्रकार `int` होता है, इसलिए `sizeof(‘A’)` का मान 4 बाइट्स आता है (C++ में यह 1 होता है) (विकल्प a)।