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
Why clrscr is used in c?
What is the heap?
What is #define in c?
Are local variables initialized to zero by default in c?
What is c definition?
What does p mean in physics?
void main(int n) { if(n==0) return; main(--n); printf("%d ",n); getch(); } how it work and what will be its output...............it any one know ans plz reply
What is the difference between union and anonymous union?
How can a process change an environment variable in its caller?
Write a program to replace n bits from the position p of the bit representation of an inputted character x with the one's complement. Method invertBit takes 3 parameters x as input character, p as position and n as the number of positions from p. Replace n bits from pth position in 8 bit character x. Then return the characters by inverting the bits.
Why c is called a middle level language?
Linked list is a Linear or non linear explain if linear how it working as a non linear data structures
What is the scope of static variables in c language?
What is the description for syntax errors?
What is the most efficient way to count the number of bits which are set in an integer?