Write a program to compare two strings without using the
strcmp() function
Answer Posted / waqar nawaz
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int c=0;
char a[10];
char b[10];
gets(a);
gets(b);
for(int i=0,j=0;b[i]!='\0'||a[j]!='\0';i++,j++)
{
if(a[i]!=b[j])
{
c++;
}
}
if(c==0)
cout<<"string match";
else
cout<<"string does not match";
getch();
}
| Is This Answer Correct ? | 104 Yes | 51 No |
Post New Answer View All Answers
Why c is called top down?
Can a void pointer point to a function?
Is c language still used?
Explain the properties of union. What is the size of a union variable
What is the size of structure pointer in c?
can anyone suggest some site name..where i can get some good data structure puzzles???
Do you know what are bitwise shift operators in c programming?
What is a loop?
How pointer is different from array?
Why is c called "mother" language?
general for is %wd,f-d; in this system "w" means a) 'w' represent total width of digits b) 'w' represent width which includes the digits before,after decimal place and the decimal point c) 'w' represent width which includes the digits before only d) 'w' represent width after decimal place only
What are the two types of structure?
Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?
What is equivalent to ++i+++j?
What is main () in c?