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...

code for copying two strings with out strcpy() function.

Answer Posted / reachhary

well, we could also have a string accepted at run time by
use of scanf.

To take care of such cases.

char *mystrcpy(char src[])
{
char *dest = NULL;
int indx = 0, len = 0;
if (!src) return dest;
len = strlen(src);
dest = (char *)malloc(sizeof(char) * len + 1);
while (; src[indx] ; dest[indx++]=src[indx]);
dest[indx]='\0'
return (dest)
}
Please do update if any one finds any issue with the code
segment - in terms of any error or any optimisation

Is This Answer Correct ?    3 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Describe explain how arrays can be passed to a user defined function

1065


how to create duplicate link list using C???

2529


Explain how can I avoid the abort, retry, fail messages?

1011


What is variable declaration and definition in c?

872


What is function pointer c?

1059


which of the following statement is wrong a) mes=123.56; b) con='T'*'A'; c) this='T'*20; d) 3+a=b;

3191


How was c created?

1009


how to print electricity bill according to following charges first 100 units -1rs per unit for next 200 units-1.50 rs per unit without using conditions

3150


What is static function in c?

1082


Write a program with dynamically allocation of variable.

1085


What are different types of pointers?

1030


What is function what are the types of function?

964


Why & is used in c?

1133


What was noalias and what ever happened to it?

1002


What is && in c programming?

1129