Write a program in C to compare two strings without using string library functions
#include <stdio.h>
void main()
{
char str1[100],str2[100];
inti;
printf(“Enter the first string:\n”);
scanf(“%s”, &str1);
printf(“Enter the second string:\n”);
scanf(“%s”, &str2);
for(i=0;str1[i]!=’\0′ || str2[i]!=’\0′;i++)
{
if(str1[i]!=str2[i])
{
printf(“Given strings are not identical\n”);
return;
}
}
printf(“Given strings are identical\n”);
}
Output:
Enter the first string:
Ekviz.com
Enter the second string:
Ekviz.com
Given strings are identical