C Programming/string.h/stricmp
Appearance
Prototype of stricmp function is
#include<string.h> int stricmp( char *str1, char *str2 );
stricmp(str1,str2) compares str1 and str2 lexicographically without regards to case . It returns a negative value if str1<str2; 0 if str1 and str2 are identical; and positive value if str1>str2.
Example:
#include <stdio.h>
#include <stdlib.h>
int main()
{
char str1[]="c proGrAmMing";
char str2[]="C PROGRAMMIG";
int i;
#ifdef __WIN32
system("cls"); // for Windows
#else
system("clear"); // for Unix and Linux
#endif
i=stricmp(str1,str2);
if(i==0)
printf("\nstr1 and str2 are identical");
else if(i<0)
printf("\n\nstr1< str2");
else
printf("\n\nstr1> str2");
getch();
return 0;
}
References
[edit | edit source]- "stricmp", C Programming Expert.com