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
why return type of main is not necessary in linux
Hai what is the different types of versions and their differences
What does != Mean in c?
Can you tell me how to check whether a linked list is circular?
List out few of the applications that make use of Multilinked Structures?
Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......
How can this be legal c?
Can we assign integer value to char in c?
How can I swap two values without using a temporary?
Is malloc memset faster than calloc?
please send me the code for multiplying sparse matrix using c
How can I change the size of the dynamically allocated array?
why arguments can generally be passed to functions a) sending the values of the arguments b) sending the addresses of the arguments c) a & b d) none of the above
What is a structural principle?
List some applications of c programming language?