Write a program to compare two strings without using the
strcmp() function
Answer Posted / raghu
#include<stdio.h>
#include<conio.h>
void main()
{
char a[100],b[100];
int i,c;
clrscr();
printf("enter first string");
scanf("%s",&a);
printf("enter second string");
scanf("%s",&b);
for(i=0;a[i]!='\0'&&b[i]!='\0';i++)
{
if(a[i]!=b[i])
{
c=1;
}
}
if(c==1)
{
printf("the strings do not match!");
}
else
{
printf("the strings match!");
}
getch();
}
Is This Answer Correct ? | 8 Yes | 4 No |
Post New Answer View All Answers
Explain what are the standard predefined macros?
What is the use of putchar function?
main() { struct s1 { char *str; struct s1 *ptr; }; static struct s1 arr[] = { {"Hyderabad",arr+1}, {"Bangalore",arr+2}, {"Delhi",arr} }; struct s1 *p[3]; int i; < BR> for(i=0;i<=2;i++) p[i] = arr[i].ptr; printf("%s ",(*p)->str); printf("%s ",(++*p)->str); printf("%s ",((*p)++)->str); }
What is property type c?
What does volatile do?
HOW TO SOLVE A NUMERICAL OF LRU IN OS ??????
What is an operator?
Why is void main used?
count = 0; for (i = 1;i < = 10; i++);count = count + i; Value of count after execution of the above statements will be a) 0 b) 11 c) 55 d) array
Differentiate between full, complete & perfect binary trees.
What is the difference between call by value and call by reference in c?
to find the closest pair
What is the newline escape sequence?
using only #include
How can a program be made to print the name of a source file where an error occurs?