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 meaning of typedef struct in c?
List out few of the applications that make use of Multilinked Structures?
What is sizeof in c?
What does 3 periods mean in texting?
how to count no of words,characters,lines in a paragraph.
What are the back slash character constants or escape sequence charactersavailable in c?
Can we access the array using a pointer in c language?
What are header files and what are its uses in C programming?
Write a program to swap two numbers without using third variable?
What is pointer to pointer in c language?
Explain union. What are its advantages?
in any language the sound structure of that language depends on its a) character set, input/output function, its control structures b) character set, library functions, input/output functions its control structures c) character set, library functions, control sturctures d) character set, operators, its control structures
How are portions of a program disabled in demo versions?
Explain what is the difference between the expression '++a' and 'a++'?
Explain what are binary trees?