write a own function to compare two strings with out using
stringcomparition function?

Answer Posted / mallesh

#include<stdio.h>
#include<conio.h>
int xstrcmp(char*,char*);
void main()
{
int c;
char a1[20],a2[20];
printf("Enter the two string's :\n");
gets(a1);
gets(a2);
c=xstrcmp(&a1[0],&a2[0]);
printf("%d",c);
getch();
}
int xstrcmp(char *a,char *a1)
{

while((*a)==(*a1))
{
if((*a=='\0')||(*a1=='\0'))
break;
++(a);
++(a1);
}
return((*a)-(*a1));
}

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the types of data files?

725


What is the most efficient way to store flag values?

683


In a switch statement, what will happen if a break statement is omitted?

600


Explain with the aid of an example why arrays of structures don’t provide an efficient representation when it comes to adding and deleting records internal to the array.

2653


How to find a missed value, if you want to store 100 values in a 99 sized array?

812






Write a program to check whether a number is prime or not using c?

571


the number of measuring units from a arbitrary starting point in a record area or control block to some other point a) branching b) recording pointer c) none d) offset

637


Explain what is operator promotion?

631


Write a C++ program to generate 10 integer numbers between - 1000 and 1000, then store the summation of the odd positive numbers in variable call it sum_pos, then find the maximum digit in this variable regardless of its digits length.

1565


WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?

1856


What is output redirection?

687


What are structures and unions? State differencves between them.

614


Which is better malloc or calloc?

645


Is void a keyword in c?

572


What are the advantages of the functions?

602