Write a program to compare two strings without using the
strcmp() function
Answer Posted / sumant maurya
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char a[10];
char b[10];
int flag=0;
clrscr();
puts("enter the first string\n");
gets(a);
puts("enter the second string\n");
gets(b);
for(int i=0;i<=strlen(a);i++)
{
if(a[i]==b[i])
{
flag=1;
}
}
if(flag==1)
{
puts("matches");
}
else
{
puts("not matches");
}
getch();
}
| Is This Answer Correct ? | 6 Yes | 8 No |
Post New Answer View All Answers
What is spaghetti programming?
What is the use of pragma in embedded c?
Why c is called a middle level language?
Explain what is operator promotion?
Why is c called c?
Can we use any name in place of argv and argc as command line arguments?
When I set a float variable to, say, 3.1, why is printf printing it as 3.0999999?
what is the significance of static storage class specifier?
How do you list files in a directory?
What are identifiers and keywords in c?
How many identifiers are there in c?
Is python a c language?
How can I determine whether a machines byte order is big-endian or little-endian?
What is 02d in c?
What is #include called?