Question 3
Back to Exercise
What is the output of the following C program on a 64-bit system?
#include <stdio.h>
struct date {
int d, m, y;
};
int main(void) {
struct date dt = {.m = 8, 2026};
printf("%d %d %d\n", dt.d, dt.m, dt.y);
return 0;
}
- A 0 8 2026 Correct
- B 2026 8 0
- C 8 2026 0
- D Compilation error
Correct Answer: Option A
After a designator, the next plain value initialises the member that follows it: m is 8, then y is 2026. d is not mentioned, so it is 0.
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!