String programs

* COMPARE TWO STRINGS

 #include<stdio.h>
#include<conio.h>
void main()
{
int i,b;
char str1[80],str2[80];
printf("Enter a string");
gets(str1);
printf("Enter another string");
gets(str2);
if(strcmp(str1,str2)==0)
   printf("Strings are equal");
else
   printf("Strings are not equal");

getch();
}

0 Comments: