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
What is file in c language?
what are # pragma staments?
how we can make 3d venturing graphics on outer interface
Difference between macros and inline functions? Can a function be forced as inline?
Why is structure important for a child?
What does double pointer mean in c?
What is s or c?
Program to find the sum of digits of a given number until the sum becomes a single digit. (e.g. 12345=>1+2+3+4+5=15=>1+5=6)
What is scope and lifetime of a variable in c?
What is pointer in c?
How can I run c program?
What is the difference between typedef and #define?
what is a constant pointer in C
Is this program statement valid? INT = 10.50;
What are the advantages of Macro over function?