The strncmp() function compares n characters in the source string with the destination string.
It returns a 0 if both strings are equal, and nonzero otherwise.
int strncmp(char *str1,char* str2,int len)
Example:
void main()
{
char str1[20] = "Hello World";
if(strncmp(str1,"Hello",5)==0)
{
printf( "Strings match" );
}
}
Output:
Strings match