Write a program to compare two strings without using the
strcmp() function
Answer Posted / raghu
#include<stdio.h>
#include<conio.h>
void main()
{
char a[100],b[100];
int i,c;
clrscr();
printf("enter first string");
scanf("%s",&a);
printf("enter second string");
scanf("%s",&b);
for(i=0;a[i]!='\0'&&b[i]!='\0';i++)
{
if(a[i]!=b[i])
{
c=1;
}
}
if(c==1)
{
printf("the strings do not match!");
}
else
{
printf("the strings match!");
}
getch();
}
Is This Answer Correct ? | 8 Yes | 4 No |
Post New Answer View All Answers
Can you write the function prototype, definition and mention the other requirements.
a c code by using memory allocation for add ,multiply of sprase matrixes
What is preprocessor with example?
code for find determinent of amatrix
How to write a program for machine which is connected with server for that server automatically wants to catch the time for user of that machine?
What is this infamous null pointer, anyway?
How do you determine a file’s attributes?
What is keyword in c?
What is an array? What the different types of arrays in c?
What are structures and unions? State differencves between them.
What is #ifdef ? What is its application?
A routine usually part of the operation system that loads a program into memory prior to execution a) linker b) loader c) preprocessor d) compiler
Which is better between malloc and calloc?
What are the storage classes in C?
What are the types of c language?