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 ? | 27 Yes | 16 No |
Post New Answer View All Answers
what do the 'c' and 'v' in argc and argv stand for?
What is an array? What the different types of arrays in c?
Can the curly brackets { } be used to enclose a single line of code?
How does placing some code lines between the comment symbol help in debugging the code?
explain what is an endless loop?
What are predefined functions in c?
What is #define in c?
write a program using linked list in which each node consists of following information. Name[30] Branch Rollno Telephone no i) Write the program to add information of students in linked list
Write a program to reverse a string.
write a program to generate address labels using structures?
What are the types of variables in c?
How is = symbol different from == symbol in c programming?
What is meant by preprocessor in c?
write a program to display all prime numbers
What is the size of enum in c?