LearnFrenzy
Sign in Take a free test

Declarations and Initializations · Predict the Output · Question 5

sizeof 10, sizeof 10.0f and sizeof "C23" Answer, explanation & discussion

  • Output
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 5 Back to Exercise

What is the output of the following C program on a 64-bit system?

main.c
#include <stdio.h>

int main(void) {
    printf("%zu %zu %zu\n", sizeof 10, sizeof 10.0f, sizeof "C23");
    return 0;
}
  • A 4 4 4 Correct
  • B 4 8 3
  • C 2 4 4
  • D 4 4 3
Correct Answer: Option A

10 is an int (4), 10.0f a float (4), and "C23" an array of 4 chars – three letters plus the terminator.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links