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

Implement strncpy

Answer Posted / ada

char *my_strncpy( char *dst, char *src, size_t n)
{
int i = n;
char *p = dst;

if(!dst || !src)
return dst;

while( i != 0 && *src != '\0' )
{
*p++ = *src++;
i --;
}

while( i!=0 )
{
*p++ = '\0';
i --;
}

return dst;
}

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

By using c++ with an example describe linked list?

980


What is a friend function in c++?

1477


What is encapsulation in c++?

1210


What is difference between n and endl in c++?

1030


When does a name clash occur in c++?

1107


Can I learn c++ without knowing c?

1001


What are put and get pointers?

1066


How are the features of c++ different from c?

1016


Can the operator == be overloaded for comparing two arrays consisting of characters by using string comparison?

1018


Where are setjmp and longjmp used in c++?

1049


What are the classes in c++?

1053


What is function overloading c++?

1021


What is const pointer and const reference?

1083


Inline parameters : What does the compiler do with the parameters of inline function, that can be evaluated in runtime ?

2450


Where and why do I have to put the "template" and "typename" keywords?

978