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
How will you find a duplicate number in a array without negating the nos ?
What is string constants?
What do you know about the use of bit field?
What is pass by reference in c?
What are the advantages of external class?
What does calloc stand for?
What is scope rule in c?
Dont ansi function prototypes render lint obsolete?
what are the 10 different models of writing an addition program in C language?
Explain what are multibyte characters?
In a switch statement, what will happen if a break statement is omitted?
What is default value of global variable in c?
What does c value mean?
Explain what is a static function?
program to convert a integer to string in c language'