Answer to Question #209454 in C for Pragadeesh T

Question #209454

write a c program to compare two strings s1 and s2.if equal print"equal" otherwise"not equal".note #define com(s1,s2)


1
Expert's answer
2021-06-22T02:37:09-0400
#include <stdio.h>
#include<string.h>
#define com(s1,s2) (strcmp(s1,s2) == 0)


int main(void)
{
	char string1[1000];
	char string2[1000];


	printf("Enter string 1: ");
	gets(string1);
	printf("Enter string 2: ");
	gets(string2);


	if(com(string1,string2)==1){
		printf("equal\n");
	}else{
		printf("not equal\n");
	}


	getchar();
	getchar();
	return(0);
}




Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS