Write a program to compare two strings without using the
strcmp() function
Answer Posted / sreevalli kamineni
main()
{
char a[50],b[50];
int i=0,flag;
puts("enter 1st string");
gets(a);
puts("enter 2nd string");
gets(b);
if(strlen(a)!=strlen(b))
puts("not identical");
else
{
while(a[i]!='\0')
{
if(a[i]==b[i])
{
i++;
flag=1;
}
else
{
puts("not identical");
}
}
if(flag==1) puts("identical");
}
| Is This Answer Correct ? | 13 Yes | 3 No |
Post New Answer View All Answers
Describe static function with its usage?
Does c have function or method?
Explain the Difference between the New and Malloc keyword.
Difference between strcpy() and memcpy() function?
What is a scope resolution operator in c?
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 is the format specifier for printing a pointer value?
What is int main () in c?
What is break in c?
A float occupies 4 bytes in memory. How many bits are used to store exponent part? since we can have up to 38 number for exponent so 2 ki power 6 6, 6 bits will be used. If 6 bits are used why do not we have up to 64 numbers in exponent?
Explain #pragma statements.
Is using exit() the same as using return?
What does a derived class inherit from a base class a) Only the Public members of the base class b) Only the Protected members of the base class c) Both the Public and the Protected members of the base class d) .c file
What is 'bus error'?
What is void main () in c?