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
What is main return c?
#define PRINT(int) printf("int = %d ",int) main() {< BR> intx,y,z; x=03;y=02;z=01; PRINT(x^x); z<<=3;PRINT(x); y>>=3;PRINT(y); }
How to write a multi-statement macro?
How many levels of indirection in pointers can you have in a single declaration?
In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)
What are comments and how do you insert it in a C program?
When should we use pointers in a c program?
What is typedef?
what are # pragma staments?
How can a string be converted to a number?
Tell me what are bitwise shift operators?
In a switch statement, explain what will happen if a break statement is omitted?
What is the difference between c and python?
What is volatile c?
What are pointers in C? Give an example where to illustrate their significance.