Write a program to compare two strings without using the
strcmp() function
Answer Posted / belsia
void main()
{
char a[10],b[10];
int i=0;
scanf("%s%s",a,b);
if(strlen(a)!=strlen(b))
printf("they are different strings");
else
{
while(a[i]!='\0')
{
if(a[i]==b[i])
i++;
else
{
printf("They are different strings");
exit(0);
}
printf("Both are same");
}
getch();
}
Is This Answer Correct ? | 27 Yes | 16 No |
Post New Answer View All Answers
How can you find the day of the week given the date?
What is conio h in c?
can any one provide me the notes of data structure for ignou cs-62 paper
Explain is it better to bitshift a value than to multiply by 2?
What is malloc and calloc?
Can the size of an array be declared at runtime?
What is the use of in c?
How many types of operators are there in c?
Where is volatile variable stored?
What is a list in c?
What is string constants?
How can you find out how much memory is available?
Is null valid for pointers to functions?
What is #define?
What is the use of a semicolon (;) at the end of every program statement?