Write a program to compare two strings without using the
strcmp() function
Answer Posted / vijay.benzamin
#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 ? | 54 Yes | 31 No |
Post New Answer View All Answers
What do you mean by a sequential access file?
What is the function of volatile in c language?
Linked list is a Linear or non linear explain if linear how it working as a non linear data structures
what is diffrence between linear and binary search in array respect to operators?what kind of operator can be used in both seach methods?
What is a pointer value and address in c?
What is the size of enum in c?
Why does the call char scanf work?
What is exit() function?
What are the 5 types of organizational structures?
Explain the use of 'auto' keyword in c programming?
Explain is it better to bitshift a value than to multiply by 2?
What are the modifiers available in c programming language?
hai iam working in sap sd module for one year and working in lumax ind ltd in desp department but my problem is i have done m.b.a in hr/marketing and working sap sd there is any combination it. can you give right solution of my problem. and what can i do?
Is main a keyword in c?
Tell me what is null pointer in c?