Write a program to compare two strings without using the
strcmp() function
Answer Posted / raghu ram. n
#include<stdio.h>
void main()
{ char string1[50], string2[50];
int i=0;
printf("Enter First String :");
gets(string1);
printf("Enter Second String :");
gets(string2);
while(string1[i]!=0&&string2[i]!=0&&srting1[i]==string2[i])
i++;
if(string1[i]=='\0'&&string2[i]=='\0')
printf("Two strings are equal");
else
printf("Two string are not equal");
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
The file stdio.h, what does it contain?
What are the advantages and disadvantages of a heap?
how to create duplicate link list using C???
How can I swap two values without using a temporary?
What is the difference between exit() and _exit() function in c?
How to establish connection with oracle database software from c language?
What is the advantage of a random access file?
how could explain about job profile
Why do we use stdio h and conio h?
How important is structure in life?
How do I convert a string to all upper or lower case?
Explain what is the use of a semicolon (;) at the end of every program statement?
How is pointer initialized in c?
void main(int n) { if(n==0) return; main(--n); printf("%d ",n); getch(); } how it work and what will be its output...............it any one know ans plz reply
Here is a neat trick for checking whether two strings are equal