Q. What is the output of the following code?

Code:
#include <stdio.h>
int main() {
    printf("%d", sizeof('A'));
    return 0;
}
  • (A) 1
  • (B) 2
  • (C) 4
  • (D) Depends on compiler
πŸ’¬ Discuss
βœ… Correct Answer: (C) 4
Explanation: In C, character literals like 'A' are treated as int, so sizeof('A') returns 4.
Explanation by: Mr. Dubey
In C, character literals like 'A' are treated as int, so sizeof('A') returns 4.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
86
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
86%
Success Rate