ProgrammingHardGATE CS
What is the exact output?
What is the exact output?
#include <stdio.h>
int main(void) {
int n = printf("%d%d", 12, 345);
printf("|%d", n);
return 0;
}- A. 5|12345
- B. 12 345|5
- C. 12345|7
- D. 12345|5
Correct answer: D. 12345|5
printf returns the number of characters it wrote. The first call prints 12345 (5 characters), and the second prints |5.
More C Programming questions
- What is printed? Assume int is 4 bytes and pointers are 8 bytes. c #include <stdio.h> void f(int a[10]) { printf("%zu ", sizeof a); } int…
- What is printed? Assume the usual ABI: char 1 byte, short 2, int 4, with each member aligned to its own size and the struct padded to a…
- What is printed? c #include <stdio.h> int main(void) { char s[] = "abcd"; char p = s; (p)++; p++ += 2; ++p; p[1]--; printf("%s", s)…
- What is printed? Assume C99 or later (division truncates towards zero). c #include <stdio.h> int main(void) { printf("%d %d %d %d", -17 /…
- What is printed? Assume unsigned int is 32 bits and unsigned char is 8 bits. c #include <stdio.h> int main(void) { unsigned int x = 1u <<…
- What is printed? c #include <stdio.h> int main(void) { int i, j, k = 0; for (i = 0, j = 20; i < j; i += 3, j -= 2) k += j - i; printf("%d…