This is a function which compares two strings to find out whether they are same or different. The two strings are compared character by character until there is a mismatch or end of one of the strings is reached, whichever occurs first. If the two strings are identical, strcmp( ) returns a value zero. If they’re not, it returns the numeric difference between the ASCII values of the first non-matching pairs of characters.
\* C Program to demonstrate strcmp() function *\
# include < stdio.h >
int main( )
{
char string1[ ] = "General" ;
char string2[ ] = "Note" ;
int i, j, k ;
i = strcmp( string1, "General") ;
j = strcmp( string1, string2) ;
k = strcmp( string1, "General Note") ;
printf(" \n %d %d %d ", i, j, k) ;
return ( 0 ) ;
}
0 6 -32