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
By using c++ with an example describe linked list?
What is a friend function in c++?
What is encapsulation in c++?
What is difference between n and endl in c++?
When does a name clash occur in c++?
Can I learn c++ without knowing c?
What are put and get pointers?
How are the features of c++ different from c?
Can the operator == be overloaded for comparing two arrays consisting of characters by using string comparison?
Where are setjmp and longjmp used in c++?
What are the classes in c++?
What is function overloading c++?
What is const pointer and const reference?
Inline parameters : What does the compiler do with the parameters of inline function, that can be evaluated in runtime ?
Where and why do I have to put the "template" and "typename" keywords?