ProgrammingHardCompetitive coding (CP)
What is printed?
What is printed?
#include <stdio.h>
#include <string.h>
int main(void) {
size_t n = 0;
printf("%d", n - 1 > 100);
}- A. 0
- B. 1
- C. 2
- D. 3
Correct answer: B. 1
n - 1 wraps to SIZE_MAX, which is far greater than 100, so the comparison is 1.
More C Programming questions
- What is printed? c #include <stdio.h> int pal(const char s, int n) { int l = 0, r = n - 1; while (l < r) { if (s[l] != s[r]) return 0…
- What is printed? c #include <stdio.h> int main(void) { int m[3][5]; for (int i = 0; i < 3; i++) for (int j = 0; j < 5; j++) m[i][j] = i 5…
- What is printed? c #include <stdio.h> void swap(int a, int b) { int t = a; a = b; b = t; } int main(void) { int x = 1, y = 2; int p = &x…
- What is printed? c #include <stdio.h> void rev(int a, int l, int r) { while (l < r) { int t = a[l]; a[l] = a[r]; a[r] = t; l++; r--; } }…
- What is printed? c #include <stdio.h> int main(void) { static const unsigned char t[16] = {0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4}; unsigned x =…
- How many times does the value change between neighbours in {1, 1, 2, 2, 2, 3, 1}? Compute with this program. c #include <stdio.h> int…