C stricmp() function

  • By using stricmp() function, we can compare string.
  • stricmp() function work without any case sensitive, i.e. upper case and lower case both are treated as same.
  • stricmp() required two arguments of type const char* and returns an integer value

Syntax:

int stricmp(const char* s1, const char* s2);

Example:

#include
#include
#include
int main()
{
char s1[15]=”K2schools”;
char s2[12]=”K2CHOOLS”;
int d;
clrscr();
puts(s1);
puts(s2);
d=stricmp(s1,s2);
printf(“ASCII value difference %d”,d);
getch();
return 0;
}

Powered by k2schools