/*C program to compare two strings without using library functions*/
#include<stdio.h>int stringCompare(char[],char[]);
int main(){
char str1[100],str2[100];
int compare;
printf("Enter first string: ");
scanf(str1);
printf("Enter second string: ");
scanf("%s",str2);
compare = stringCompare(str1,str2);
if(compare == 1)
printf("Both strings are equal.");
else
printf("Both strings are not equal");
return 0;
}
output
Enter first string: c_programmingEnter second string: c_programming
Both strings are equal.
Comments
Post a Comment