Write a program to compare two strings without using the
strcmp() function
Answer Posted / sumant maurya
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char a[10];
char b[10];
int flag=0;
clrscr();
puts("enter the first string\n");
gets(a);
puts("enter the second string\n");
gets(b);
for(int i=0;i<=strlen(a);i++)
{
if(a[i]==b[i])
{
flag=1;
}
}
if(flag==1)
{
puts("matches");
}
else
{
puts("not matches");
}
getch();
}
| Is This Answer Correct ? | 6 Yes | 8 No |
Post New Answer View All Answers
Can you please explain the difference between syntax vs logical error?
In the DOS enveronment, normal RAM that resides beyond the 1mb mark. a) expanded memory b) swapped memory c) Extended memory d) none
What is wrong in this statement? scanf(“%d”,whatnumber);
What are valid operations on pointers?
1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. 2) the Event Manager has to send participants to the stage to perform in the order in which they registered. Write a program that will help the Event Manager know who to call to the stage to perform. The Logic should be in Data Structures
What are linker error?
If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?
What is bss in c?
Describe the complexity of Binary search, Quicksort and various other sorting and searching techniques..
What does int main () mean?
How is pointer initialized in c?
Explain can you assign a different address to an array tag?
Are pointers integers in c?
what is a constant pointer in C
Do pointers need to be initialized?