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 is the general form of function in c?
What is c language in simple words?
How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same
Explain what is gets() function?
‘ C’ PROGRAME TO SHOW THE TYPE OF TRANGLE BY ACCEPTING IT’S LENGTH .
Explain which of the following operators is incorrect and why? ( >=, <=, <>, ==)
Explain low-order bytes.
Why do some versions of toupper act strangely if given an upper-case letter?
Write a program to input the price of 1 burger and the number of burgers eaten by a group of friends .print the total amount to be paid by the group?
c language supports bitwise operations, why a) 'c' language is system oriented b) 'c' language is problem oriented c) 'c' language is middle level language d) all the above
What is declaration and definition in c?
which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above
explain what are actual arguments?
What is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?
Is int a keyword in c?