ProgrammingHardProduct company OA
What is printed?
What is printed?
const char *s = "ab\
cd";
printf("%zu", strlen(s));- A. 5
- B. Compilation error
- C. 4
- D. 6
Correct answer: C. 4
A backslash immediately followed by a newline is deleted in an early translation phase, splicing the two lines into one: the literal is just "abcd", 4 characters. Neither the backslash nor the newline ends up in the string.
More C Programming questions
- On an LP64 system (32-bit int, 64-bit long), what is printed? c printf("%zu %zu", sizeof(2147483647), sizeof(2147483648));
- What is printed? c printf("%d %d", '0', '0');
- What is printed? c printf("%d %d", !!"", !"");
- How many subsets does this code count? c int a[] = {2, 3, 5, 7, 8}, c = 0; for (int m = 0; m < 32; m++) { int s = 0; for (int i = 0; i <…
- What is the type of the result of subtracting two int pointers, p - q?
- What is printed? c char s[] = "xya", p = s; char a = p++; char b = ++p; char c = ++p; printf("%c%c%c %s", a, b, c, s);