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

Difference between inline functions and macros?

1088


What is a NULL Macro? What is the difference between a NULL Pointer and a NULL Macro?

1157


Can a list of string be stored within a two dimensional array?

1038


How we can differentiate between a pre and post increment operators during overloading?

1152


How does the copy constructor differ from the assignment operator (=)?

1189


How the programmer of a class should decide whether to declare member function or a friend function?

1176


What is functions syntax in c++?

1193


What is the meaning of c++?

1070


Why struct is used in c++?

1169


What is an html tag?

1221


Write a program which uses Command Line Arguments

1224


What is an arraylist c++?

1267


What is iomanip c++?

1111


How does c++ structure differ from c++ class?

1179


What are separators in c++?

1126