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

What are the characteristics of friend functions?

973


Define the operators that can be used with a pointer.

1004


How the delete operator differs from the delete[]operator?

1057


What are the advantages of c++?

1787


How would perform Pattern Matching in C++?

1182


What is pair in c++?

1013


What is a template in c++?

1756


Can we make any program in c++ without using any header file and what is the shortest program in c++.

1079


What do you mean by function pointer?

1056


What is the difference between global variables and local variable

1001


What is the difference between #import and #include in c++?

1068


Is it possible to pass an object of the same class in place of object reference to the copy constructor?

987


what kind of projects are suitable for c and c++

1000


What operators can you overload in c++?

1004


Explain queue. How it can be implemented?

1114