C strcmp()

C strcmp():

String Functions are the built-in functions provided by C to operate and manipulate a string. C strcmp() function compares two strings and returns 0 value if the strings are same, else it returns 1.

Syntax:

strcmp(string1, string2)

Example:

#include<stdio.h>  
#include <string.h>  
#include <stdbool.h>
 
void main()
{    
char str1[10] = "Hello C. ";  
char str2[20] = "Hello World.";  
bool a;
 
a = strcmp(str1, str2);
printf ("%d\n",a);
}

Output

1
Please follow and like us:
Content Protection by DMCA.com