LearnFrenzy
Sign in Take a free test

Declarations and Initializations · Predict the Output · Question 1

int* a, b; – sizes of a and b Answer, explanation & discussion

  • Output
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 1 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) {
    int* a, b;
    printf("%zu %zu\n", sizeof a, sizeof b);
    return 0;
}
  • A 8 4 Correct
  • B 8 8
  • C 4 4
  • D 4 8
Correct Answer: Option A

The * belongs to the declarator a, not to the type. a is an int pointer (8 bytes) and b a plain int (4 bytes), however the spacing looks.

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