String comparison

String comparison in C

#include
#include
int main()
{
char str1[]=”A AND”;
char str2[]=”B”;
int i;
clrscr();
i=strcmp(str1,str2);
if(i==0)
printf(“\n\nstr1 and str2 are identical”);
else if(i<0)
printf(“\n\nstr1< str2”);
else
printf(“\n\nstr1< str2”);
getch();
return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *