ProgrammingHardTCS NQT · Accenture

What is printed?

What is printed?
#include <stdio.h>
#include <string.h>
int main(void) {
    char *names[] = {"x", "yy", "zzz"};
    char **pp = names + 1;
    printf("%c%d", **pp, (int)strlen(*(pp + 1)));
}
  1. A. y3
  2. B. y2
  3. C. x3
  4. D. z3

Correct answer: A. y3

pp points at names[1], so **pp is the first character of "yy", which is y. *(pp + 1) is "zzz", whose length is 3.

More C Programming questions

Exams that ask this topic