Write a program to compare two strings without using the
strcmp() function
Answer Posted / belsia
void main()
{
char a[10],b[10];
int i=0;
scanf("%s%s",a,b);
if(strlen(a)!=strlen(b))
printf("they are different strings");
else
{
while(a[i]!='\0')
{
if(a[i]==b[i])
i++;
else
{
printf("They are different strings");
exit(0);
}
}
printf("Both are same");
}
getch();
}
| Is This Answer Correct ? | 10 Yes | 13 No |
Post New Answer View All Answers
Hai,I have done with my bachelor of commerce and planing to ms,please suggest me how to convince vo for shifting from commerce to computers. Visa on 8 DEC 2014 Npu university
In C programming, what command or code can be used to determine if a number of odd or even?
What is difference between class and structure?
How are variables declared in c?
If I have a char * variable pointing to the name of a function ..
Give me the code of in-order recursive and non-recursive.
What is the difference between abs() and fabs() functions?
why do some people write if(0 == x) instead of if(x == 0)?
what are the 10 different models of writing an addition program in C language?
How do you print only part of a string?
a construct the"else" part of "if" statement contains anoth "if else" statement is called a) if-else b) else-if-else c) if-else-if-else d) chain if/if-else-if
Which is an example of a structural homology?
Explain the properties of union.
Why main is used in c?
Write a code to determine the total number of stops an elevator would take to serve N number of people.