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 are the differences between Structures and Arrays?
What is table lookup in c?
What is the use of #define preprocessor in c?
How to find a missed value, if you want to store 100 values in a 99 sized array?
Explain what are the different data types in c?
Write a program to use switch statement.
program for reversing a selected line word by word when multiple lines are given without using strrev
Can you please explain the scope of static variables?
Can a function argument have default value?
What is New modifiers?
What is the purpose of clrscr () printf () and getch ()?
What is the difference between malloc calloc and realloc in c?
How do you list a file’s date and time?
What is 1f in c?
What is memory leak in c?