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 we assign integer value to char in c?
What are the properties of union in c?
Program will then find the largest of three numbers using nested if-else statements. User is prompted to enter three numbers. Program will find the largest number and display it on the screen. All three numbers entered by the user are also displayed. If user enters 21, 33, and 5, the output should be as follows: You entered: 21, 33 and 5. The largest number is 33.
What is function pointer c?
Write an efficient algo and C code to shuffle a pack of cards.. this one was a feedback process until we came up with one with no extra storage.
Why c is a procedural language?
What is NULL pointer?
I need a sort of an approximate strcmp routine?
regarding pointers concept
Explain low-order bytes.
What is the difference between far and near ?
What is the use of function overloading in C?
What are the 4 types of programming language?
What does 3 periods mean in texting?
Explain what are the different file extensions involved when programming in c?