C – Strcmp

C – Strcmp 2017-08-06T09:03:38+00:00

Strcmp :

strcmp(str1,str2) compares str1 and str2 lexicographically .Returns a negative value if str1<str2; 0 if str1 and str2 are identical; and positive value if str1>str2.

Syntax :
int strcmp( char *str1, char *str2 );

C – STRCMP EXAMPLE PROGRAM :

 

Output :

Enter first string

I  love the world

Enter second string

I love the world

str1 : I love the world

str2 : I love the world

str1 and str2 are identical

Prev Next