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 / shanmugavalli

char* strncpy(char* dest,const char* src,int n)
{
while(n>0)
{
if (!(*dest = *src)) break;
src++;
dest++;
n--;
}
if (n<=0) *dest = '\0';
return dest;
}

Is This Answer Correct ?    3 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between prefix and postfix versions of operator++()?

1086


Why cout is used in c++?

1029


What is the use of dot in c++?

1086


What is object file? How can you access object file?

1209


What are the steps in the development cycle?

1102


What are the benefits of c++?

1056


Is it possible to provide special behavior for one instance of a template but not for other instances?

1134


Why do we use structure in c++?

1082


Why struct is used in c++?

1126


What is array give example?

1058


What is the size of integer variable?

1066


What do you mean by “this” pointer?

1072


Explain the problem with overriding functions

1163


What programming language should I learn first?

1103


What are separators in c++?

1093