ProgrammingHard

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

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

Correct answer: A. 1

Lowercasing both characters, L matches l and e matches e, so the palindrome test passes.

More C Programming questions

Exams that ask this topic