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
Is c weakly typed?
In this problem you are to write a program that will cut some number of prime numbers from the list of prime numbers between 1 and N.Your program will read in a number N; determine the list of prime numbers between 1 and N; and print the C*2 prime numbers from the center of the list if there are an even number of prime numbers or (C*2)-1 prime numbers from the center of the list if there are an odd number of prime numbers in the list.
Why c is a mother language?
Explain the difference between getch() and getche() in c?
Differentiate between declaring a variable and defining a variable?
What is volatile, register definition in C
Why is c called a structured programming language?
How to declare a variable?
Please send me WIPRO technical question to my mail ID.. its nisha_g28@yahoo.com please its urgent
What is difference between static and global variable in c?
What is a node in c?
What is the use of function in c?
What is the difference between formatted&unformatted i/o functions?
Difference between Shallow copy and Deep copy?
What are control structures? What are the different types?