Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Write a program to compare two strings without using the
strcmp() function

Answer Posted / belsia

void main()
{
char a[10],b[10];
int i=0;
scanf("%s%s",a,b);
if(strlen(a)!=strlen(b))
printf("they are different strings");
else
{
while(a[i]!='\0')
{
if(a[i]==b[i])
i++;
else
{
printf("They are different strings");
exit(0);
}
printf("Both are same");
}
getch();
}

Is This Answer Correct ?    27 Yes 16 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are different types of pointers?

1021


What are the preprocessor categories?

1009


Who is the main contributor in designing the c language after dennis ritchie?

967


What is a #include preprocessor?

1095


application areas a 'c' a) operating system b) graphics, interpreter, assembler c) program evalution, communication softwares d) all the above

1025


main() { int i = 10; printf(" %d %d %d ", ++i, i++, ++i); }

1101


How can I write a function that takes a format string and a variable number of arguments?

1005


What is static memory allocation?

1119


Can a pointer be volatile in c?

946


Write a function that will take in a phone number and output all possible alphabetical combinations

1011


Why is extern used in c?

1063


What is volatile variable how do you declare it?

1043


Explain what is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?

1061


What is a MAC Address?

1017


cin.ignore(80, _ _);This statement a) ignores all input b) ignores the first 80 characters in the input c) ignores all input till end-of-line d) iteration

1063