#include<stdio.h>
#include<conio.h>
#include<string.h>
int comp(char *a, char *b,int x,int y);
int main()
{
char g[50],f[50];
int q,w,e,r;
printf("Enter first sring :\n");
gets(g);
printf("\nEnter second string:\n");
gets(f);
comp(g,f,strlen(g),strlen(f));
return 0;
}
int comp(char *a, char *b,int x,int y)
{
int i;
if(x!=y)
printf("The strings are not same.");
else
{
for(i=0;i<x;i++)
{
if(*a!=*b)
{
printf("Not same");
getch();
return 0;
}
*a++;
*b++;
}
printf("Strings are same.");
}
getch();
return 0;
}
No comments:
Post a Comment