ProgrammingHard
char *words[] = {"ab", "cd", "ef"}; char **pp = words + 1; printf("%s", *pp + 1); What is printed?
- A. cd
- B. d
- C. c
- D. ab
Correct answer: B. d
pp points at the second pointer, so *pp is "cd", and adding 1 starts the output at 'd'.
More C Programming questions
- int a[] = {10, 20, 30}; int p = a; p++; printf("%d", p + p[1]); What is printed?
- int x = 1, y = 2; int p = &x, pp = &p; pp = &y; printf("%d %d", x, p); What is printed?
- int inc(int n) { return n + 1; } int dbl(int n) { return n 2; } int (f[2])(int) = {inc, dbl}; printf("%d", f[1](f[0](3))); What is printed?
- int x = 2; switch (x) { case 2: x += 1; case 3: x += 10; break; default: x = 0; } printf("%d", x); What is printed?
- int p = (int[]){4, 5, 6}; printf("%d", p[2]); What is printed?
- int s = 0; for (int i = 0, j = 5; i < j; i++, j--) s += i j; printf("%d", s); What is printed?