ProgrammingHard

char a[] = "Level"; int pal = 1; for (int i = 0, j = 4; i < j; i++, j--) if (a[i] != a[j]) pal = 0; printf("%d", pal); What is printed?

  1. A. 1
  2. B. 2
  3. C. 3
  4. D. 0

Correct answer: D. 0

L and l differ in case, so the case-sensitive test fails at the first pair and pal becomes 0.

More C Programming questions

Exams that ask this topic