How does C++ handle lexicographical string comparison?

  • ABy length only
  • BBy character ASCII values in order
  • CRandomly
  • DBy reversing strings
Show answerHide answer

Correct answer B

In C++, strings are compared lexicographi cally using the <, >, == operators. Comparison proceeds character by character from left to right. Each character is evaluated using its ASCII (or Unicode) value.