ProgrammingHardAccenture · Capgemini · C
What is the output of this C program (assume a typical 64-bit platform: int 32 bits, long and pointers 64 bits, double 8 bytes, structs aligned to their widest member with no packing pragma)? #include <stdio.h> int maxOf(int a, int b) { return a > b ? a : b; } int maxOf3(int a, int b, int c) { return maxOf(maxOf(a, b), c); } int main(void) { printf("%d", maxOf3(7, 12, 9)); return 0; }
- A. 12
- B. 7
- C. 28
- D. 9
Correct answer: A. 12
maxOf3 composes maxOf: maxOf(7,12)=12, then maxOf(12,9)=12.
More C Programming questions
- What is the output of this C program (assume a typical 64-bit platform: int 32 bits, long and pointers 64 bits, double 8 bytes, structs…
- What is the output of this C program (assume a typical 64-bit platform: int 32 bits, long and pointers 64 bits, double 8 bytes, structs…
- What is the output of this C program (assume a typical 64-bit platform: int 32 bits, long and pointers 64 bits, double 8 bytes, structs…
- What is the output of this C program (assume a typical 64-bit platform: int 32 bits, long and pointers 64 bits, double 8 bytes, structs…
- In C, sizeof(char) is:
- Which storage class makes a local variable keep its value between calls to the function?