A

Admin • 833K Points
Coach

Q. Which function is used to compare two strings in C?

  • (A) strcmp()
  • (B) strcmpi()
  • (C) compare()
  • (D) cmpi()
  • Correct Answer - Option(A)
  • Views: 25
  • Filed under category C Programming
  • Hashtags:

Explanation by: Admin

The function strcmp() is used to compare two strings in C language.

The strcmp() is a built-in library function and is declared in <string.h> header file. This function takes two strings as arguments and compare these two strings lexicographically.

Syntax:

int strcmp(const char* str1, const char* str2);

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.