Powered By Blogger

Monday, May 4, 2009

C Programming

#include
#include
int compstr(char a[],char b[]);
void main()
{
clrscr();
char str1[50],str2[50];
int x;
printf("Enter first string:");
gets(str1);
printf("Enter second string:");
gets(str2);
x=compstr(str1,str2);
if(x==0)
printf("The two string are equal:");
else
printf("The two string are not equal:");
getch();
}
int compstr(char str1[],char str2[])
{
int y,i=0;
while(str1[i]!='\0'||str2[i]!='\0')
{

if(str1[i]!=str2[i])
{
y=-1;
break;
}
else
y=0;
i++;

}
return y;
}

0 comments:

About This Blog

This is an important blog about updated news about computer science and technology.

Blog Archive

Visitors

  © Free Blogger Templates Blogger Theme II by Ourblogtemplates.com 2008

Back to TOP