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
Sir i need notes for structure,functions,pointers in c language can you help me please
Why is it important to memset a variable, immediately after allocating memory to it ?
Is c easy to learn?
Can a program have two main functions?
write a program in c language to print your bio-data on the screen by using functions.
Can you please explain the difference between syntax vs logical error?
Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create.
write a program to print the consecutive repeated character from the given string... input string is : hhhhjkutskkkkkggggj output should be like this: hhhhkkkkkgggg anyone help me...
What is a static function in c?
How to create struct variables?
Can two or more operators such as and be combined in a single line of program code?
Explain goto?
how many key words availabel in c a) 28 b) 31 c) 32
What is c system32 taskhostw exe?
Can you please explain the scope of static variables?