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

Explain Memory Allocation in C/C++ ?

1060


What is exception handling? Does c++ support exception handling?

1026


What are containers in c++?

983


What is a float in c++?

978


What is a vector c++?

1157


When there is a global variable and local variable with the same name, how will you access the global variable?

1086


Why do we need function?

1046


What is microsoft c++ redistributable?

1082


Can a new be used in place of old mallocq? If yes, why?

1086


What is the extension of c++?

968


Can we overload operator in c++?

1024


Comment on assignment operator in c++.

1100


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

1111


How long will it take to learn programming?

1047


int age=35; if(age>80) {Console.WriteLine("Boy you are old");} else {Console.WrieLine("That is a good age");}

1252