C

Chandani • 9.81K Points
Tutor III

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

  • (A) strcmp()
  • (B) strcmpi()
  • (C) compare()
  • (D) cmpi()

Explanation by: Chandani
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.


Question analytics