Machine-translated by Google. Questions are authored in English.
Top

Discussion

Which of the following function compares 2 strings with case-insensitively?

  • A.strcmp(s, t)
  • B.strcmpcase(s, t)
  • C.strcasecmp(s, t)
  • D.strchr(s, t)

Answer: C

Correct answer: strcasecmp(s, t)

strcasecmp compares two strings ignoring the difference between upper and lower case. It is a POSIX function rather than a standard C one - the Microsoft spelling is _stricmp - but it is available almost everywhere. strcmp compares by character code, so "abc" and "ABC" come out unequal.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.