Write a program to compare two strings without using the
strcmp() function
Answer Posted / anil sai krishna
#include<stdio.h>
main()
{
char a[15],b[15];
int i,l=0,m;
printf("enter the two strings");
scanf("%s%s",a,b);
for(i=0;a[i]=b[i];i++)
{
l++;
}
for(i=0;a[i]!='\0';i++)
{
m++;
}
if(l==m)
{
printf("strings are equal");
}
else
{
printf("not equal");
}
}
| Is This Answer Correct ? | 7 Yes | 5 No |
Post New Answer View All Answers
What are header files? What are their uses?
What are the advantages of external class?
How can I call system when parameters (filenames, etc.) Of the executed command arent known until run time?
Can you pass an entire structure to functions?
What is an array in c?
What is the value of h?
What are the different file extensions involved when programming in C?
Explain how do you determine the length of a string value that was stored in a variable?
What is the purpose of type declarations?
Linked list is a Linear or non linear explain if linear how it working as a non linear data structures
What is the value of uninitialized variable in c?
What is the use of header files?
What is a shell structure examples?
In this assignment you are asked to write a multithreaded program to find the duplicates in an array of 10 million integers. The integers are between -5000,000 to 5000,000 and are generated randomly. Use 10 threads, each thread works on 1000,000 integers. Compare the time needed to accomplish the task with single thread of execution program. Do not include the time to fill the array with integers in the execution time.
What are the types of pointers in c?