Write a program to compare two strings without using the
strcmp() function
Answer Posted / anil sai krishna
#include<stdio.h>
main()
{
char a[15],b[15];
int i,l=0,m;
printf("enter the two strings");
scanf("%s%s",a,b);
for(i=0;a[i]=b[i];i++)
{
l++;
}
for(i=0;a[i]!='\0';i++)
{
m++;
}
if(l==m)
{
printf("strings are equal");
}
else
{
printf("not equal");
}
}
| Is This Answer Correct ? | 7 Yes | 5 No |
Post New Answer View All Answers
What is the use of linkage in c language?
How to write a program for machine which is connected with server for that server automatically wants to catch the time for user of that machine?
Can you add pointers together? Why would you?
Can you please compare array with pointer?
What is time complexity c?
Differentiate between declaring a variable and defining a variable?
Can math operations be performed on a void pointer?
Can you write the function prototype, definition and mention the other requirements.
What is restrict keyword in c?
Is c is a procedural language?
Is c procedural or functional?
Explain what are bus errors, memory faults, and core dumps?
Explain is it valid to address one element beyond the end of an array?
What are the properties of union in c?
What is meant by type specifiers?