Write a program to compare two strings without using the
strcmp() function
Answer Posted / premkumar
#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 ? | 69 Yes | 24 No |
Post New Answer View All Answers
What is the easiest sorting method to use?
Why does not c have an exponentiation operator?
Which is best book for data structures in c?
The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this
What are void pointers in c?
Why clrscr is used after variable declaration?
What functions are used in dynamic memory allocation in c?
what is the difference between 123 and 0123 in c?
How do I copy files?
show how link list can be used to repersent the following polynomial i) 5x+2
Write a program to print fibonacci series using recursion?
Difference between macros and inline functions? Can a function be forced as inline?
What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.
what are non standard function in c
What is the auto keyword good for?