Write a program to compare two strings without using the
strcmp() function
Answer Posted / raj
#include<stdio.h>
void main()
{
char name[80],name1[80];
int i;
printf("enter 1st string");
gets(name);
printf("enter 2st string");
gets(name1);
i=0;
while(name[i]==name1[i] && name1[i]!='\0')
i++;
if(name[i]==name1[i])
printf("two strings r equal\n");
else
printf("two strings r not equal\n");
}
| Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
What are runtime error?
What is signed and unsigned?
How can I determine whether a machines byte order is big-endian or little-endian?
What is a shell structure examples?
How many identifiers are there in c?
What is the difference between fread and fwrite function?
In a switch statement, what will happen if a break statement is omitted?
What are categories used for in c?
What is the use of static variable in c?
Describe static function with its usage?
What is the advantage of using #define to declare a constant?
Do pointers take up memory?
What is mean by Data Driven framework in QTP? Can any one answer me in details on this regard.
Differentiate fundamental data types and derived data types in C.
Explain what is the benefit of using const for declaring constants?