0
777views
Write a program to compare two string and find whether they are equal or not.
1 Answer
0
1views
#include<string.h>
main() 
{ 
char s1[20],s2[20],s3[20]; 
int x, l1, l2, l3; 
printf(“Enter two string constants \n”); 
printf(“?”); 
scanf(“%s %s”, s1, s2); 
x = strcmp(s1, s2); 
if(x != 0) 
printf(“Strings are not equal \n”); 
strcat(s1, s2); 
else 
 printf(“Strings are equal \n”); 
strcpy(s3,s1); 
l1 = strlen(s1); 
l2 = strlen(s2); 
l3 = strlen(s3); 
printf(“\ns1 …

Create a free account to keep reading this post.

and 4 others joined a min ago.

Please log in to add an answer.