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 atoi and atof in c?
What is null in c?
How can I make sure that my program is the only one accessing a file?
Can main () be called recursively?
How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?
Why can’t constant values be used to define an array’s initial size?
What is meant by preprocessor in c?
In c language can we compile a program without main() function?
What is substring in c?
What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers
What is the total generic pointer type?
Why we use void main in c?
Why is c still so popular?
GIVEN A FLOATING POINT NUMBER HOW IS IT ACTUALLY STORED IN MEMORY ? CAN ANYONE EXPLAIN?? THE 32 BIT REPRESENTATION OF A FLOATING POINT NUMBER ALLOTS: 1 BIT-SIGN 8 BITS-EXPONENT 23 BITS-MANTISSA
How to draw the flowchart for structure programs?