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 pointers in c with example?
What is the difference between struct and union in C?
How do we print only part of a string in c?
What does typeof return in c?
What is the difference between array and linked list in c?
WRITE A CODE IN C TO SEARCH A FILE FROM NOTEPAD FILE.
When should we use pointers in a c program?
What is pass by value in c?
Should a function contain a return statement if it does not return a value?
How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same
Explain what does a function declared as pascal do differently?
Are there constructors in c?
please send me the code for multiplying sparse matrix using c
List the difference between a 'copy constructor' and a 'assignment operator' in C?
How can you draw circles in C?