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 are the basics of local (auto) objects?

1077


List different attributes in C++?

1014


Can I have a reference as a data member of a class? If yes, then how do I initialise it?

1158


Describe linkages and types of linkages?

942


Is turbo c++ free?

1015


What are the types of array in c++?

1089


Define the process of handling in case of destructor failure?

992


What is abstract class in c++?

982


Is it legal in c++ to overload operator++ so that it decrements a value in your class?

1006


What information can an exception contain?

1093


What is the benefit of encapsulation?

1015


Write a program in C++ for Fibonacci series

1134


Show the application of a dynamic array with the help of an example.

1072


What is flag in computer?

982


Write is a binary search tree? Write an algo and tell complexity?

969