ProgrammingVery hardProduct company OA
What is printed?
What is printed?
#define CAT(a, b) a##b
printf("%d", CAT(1, 2) + CAT(0x, 1F));- A. 3
- B. Compilation error
- C. 13
- D. 43
Correct answer: D. 43
## glues tokens into a single token: 1 and 2 become 12, and 0x and 1F become the hexadecimal constant 0x1F = 31. 12 + 31 = 43. '3' assumes the arguments are added before pasting.
More C Programming questions
- What is printed? c #define f(x) ((x) 2) int (f)(int x) { return x + 100; } int main(void) { printf("%d %d", f(1), (f)(1)); }
- What is printed? c if (strcmp("abc", "abc")) puts("same"); else puts("different");
- Assume ASCII. What is printed? c int x = 'A' + 1.5; printf("%c %d", x, x);
- Given int m[3][4];, why can m not be passed to a function declared void f(int p);?
- Assume C99 or later. What is printed? c void f(int n, int a[][n]) { printf("%zu", sizeof a[0] / sizeof a[0][0]); } int main(void) { int…
- What is printed? c int c = 0; for (int i = 1; i <= 10; i++) for (int j = i; i j <= 10; j++) c++; printf("%d", c);