ProgrammingHard
printf("%zu", sizeof("a" "bc")); What is printed?
- A. 4
- B. 3
- C. 2
- D. 5
Correct answer: A. 4
Adjacent string literals are concatenated before any other step, so the literal is "abc", an array of 4 chars including the terminator.
More C Programming questions
- char c = 'a' + 25; printf("%c", c); What is printed on an ASCII system?
- int r = strcmp("abc", "abd"); What can be said about r according to the C standard?
- const char s = "abcabc"; printf("%ld", (long)(strstr(s, "ca") - s)); What is printed?
- char d[4] = "abc"; printf("%zu", sizeof d - strlen(d)); What is printed?
- char s[] = "Hello"; for (char p = s; p; p++) if (p >= 'a' && p <= 'z') p -= 32; printf("%s", s); What is printed?
- int a, b; int n = sscanf("12-34", "%d-%d", &a, &b); printf("%d", b); What is printed?