Write a program to compare two strings without using the
strcmp() function
Answer Posted / raghu
#include<stdio.h>
#include<conio.h>
void main()
{
char a[100],b[100];
int i,c;
clrscr();
printf("enter first string");
scanf("%s",&a);
printf("enter second string");
scanf("%s",&b);
for(i=0;a[i]!='\0'&&b[i]!='\0';i++)
{
if(a[i]!=b[i])
{
c=1;
}
}
if(c==1)
{
printf("the strings do not match!");
}
else
{
printf("the strings match!");
}
getch();
}
| Is This Answer Correct ? | 8 Yes | 4 No |
Post New Answer View All Answers
Explain about the constants which help in debugging?
What does return 1 means in c?
Why main is used in c?
Is swift based on c?
Why can't I perform arithmetic on a void* pointer?
What is the acronym for ansi?
What is assignment operator?
What is difference between && and & in c?
What are qualifiers and modifiers c?
Difference between constant pointer and pointer to a constant.
Which one would you prefer - a macro or a function?
What are different types of operators?
Can we use any name in place of argv and argc as command line arguments?
Is struct oop?
Hi can anyone tell what is a start up code?