ProgrammingHardAccenture · C
What is printed?
What is printed?
int n = printf("ab%d", 123);
printf(" %d", n);- A. ab123 3
- B. ab123 6
- C. ab123 5
- D. ab123 0
Correct answer: C. ab123 5
printf returns the number of characters written: 'a', 'b' and '1', '2', '3' make 5.
More C Programming questions
- What is printed? c enum { A, B = 5, C, D = C + 2, E }; printf("%d %d %d", C, D, E);
- What is printed? c unsigned int x = 0xB4; printf("%u %u", x & -x, x & (x - 1));
- What is printed? Assume a C compiler where double is larger than float. c printf("%d %d %d", sizeof('a') == sizeof(int), sizeof(1.5f) ==…
- What is printed? c int m[3][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; int (p)[3] = m + 1; printf("%d %d %d", (p)[2], p[1][0], ((p - 1))[1]);
- What is printed? c int a[] = {5, 10, 15, 20}; int p = a; p++ += 3; (p)++; ++p; ++p = 2; printf("%d %d %d %d %d", a[0], a[1], a[2], a[3]…
- What is printed? c unsigned char a = 250, b = 10; printf("%d %d", (a + b) > 255, (unsigned char)(a + b));