Write a program to compare two strings without using the
strcmp() function
Answer Posted / bharat prajapati
#include <stdio.h>
#include <string.h>
main()
{
char s1[10],s2[10];
int i,j;
clrscr();
printf("\nEnter first String:");
scanf("%s",s1);
printf("\nEnter second String:");
scanf("%s",s2);
for(i=0;s1[i]!='\0';i++)
{
for(j=0;s2[j]!='\0';j++)
{
if(s1[i] == s2[j])
continue;
}
}
if (i==j)
{
printf("String s1 : %s and s2 : %s are EQUAL \n",s1,s2);
}
else
printf("String s1 : %s and s2 : %s are NOT EQUAL
\n",s1,s2);
getch();
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Explain what are the different data types in c?
This is a variation of the call_me function in the previous question:call_me (myvar)int *myvar;{ *myvar += 5; }The correct way to call this function from main() will be a) call_me(myvar) b) call_me(*myvar) c) call_me(&myvar) d) expanded memory
Write a program to find the biggest number of three numbers in c?
Define Spanning-Tree Protocol (STP)
Write a Program to accept different goods with the number, price and date of purchase and display them
a parameter passed between a calling program and a called program a) variable b) constant c) argument d) all of the above
What are the features of the c language?
What is storage class?
What is sizeof c?
What is the advantage of an array over individual variables?
what are bit fields? What is the use of bit fields in a structure declaration?
Explain how do you list a file’s date and time?
write a proram to reverse the string using switch case?
When should we use pointers in a c program?
What are unions in c?