Write a program to compare two strings without using the
strcmp() function
Answer Posted / raj
#include<stdio.h>
void main()
{
char name[80],name1[80];
int i;
printf("enter 1st string");
gets(name);
printf("enter 2st string");
gets(name1);
i=0;
while(name[i]==name1[i] && name1[i]!='\0')
i++;
if(name[i]==name1[i])
printf("two strings r equal\n");
else
printf("two strings r not equal\n");
}
| Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
How is a pointer variable declared?
What is the acronym for ansi?
int far *near * p; means
What's the total generic pointer type?
What is the concatenation operator?
What is variables in c?
What is wild pointer in c?
develop algorithms to add polynomials (i) in one variable
List the difference between a "copy constructor" and a "assignment operator"?
What is structure packing in c?
What is string length in c?
How can I call a function with an argument list built up at run time?
How many types of arrays are there in c?
Explain how to reverse singly link list.
What is meant by errors and debugging?