C Program to compare two strings using built in functions
Program
#include<stdio.h>
void main()
{
char str_one[20], str_two[20];
printf("Enter string one:\t");
scanf(" %s", str_one);
printf("Enter string two:\t");
scanf(" %s", str_two);
if(strcmp(str_one, str_two))
printf("Strings are not equal\n");
else
printf("Strings are equal\n");
}
Output 1
Enter string one: america
Enter string two: america
Strings are equal
Output 2
Enter string one: mexico
Enter string two: canada
Strings are not equal