Write a program to compare two strings without using the
strcmp() function
Answer Posted / bharat prajapati
#include <stdio.h>
#include <string.h>
main()
{
char s1[10],s2[10];
int i,j;
clrscr();
printf("\nEnter first String:");
scanf("%s",s1);
printf("\nEnter second String:");
scanf("%s",s2);
for(i=0;s1[i]!='\0';i++)
{
for(j=0;s2[j]!='\0';j++)
{
if(s1[i] == s2[j])
continue;
}
}
if (i==j)
{
printf("String s1 : %s and s2 : %s are EQUAL \n",s1,s2);
}
else
printf("String s1 : %s and s2 : %s are NOT EQUAL
\n",s1,s2);
getch();
}
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
One of the Institutes contains 5 student groups. Every group contains 4 students. Institute wants to store student group’s details in array. Group should contain group member’s details (name and registration number and age), project name, and mark of the group.
difference between native and cross compilers
What type is sizeof?
write a program that reads lines(using getline), converts each line to an integer using atoi, and computes the average of all the numbers read. also compute the standard deviation.
What is dynamic variable in c?
What is integer constants?
What is the difference between #include
Explain what could possibly be the problem if a valid function name such as tolower() is being reported by the c compiler as undefined?
What is the hardest programming language?
Tell us something about keyword 'auto'.
What is assignment operator?
How do you initialize pointer variables?
how to execute a program using if else condition and the output should enter number and the number is odd only...
What is the right way to use errno?
Is return a keyword in c?