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
Difference between inline functions and macros?
What is a NULL Macro? What is the difference between a NULL Pointer and a NULL Macro?
Can a list of string be stored within a two dimensional array?
How we can differentiate between a pre and post increment operators during overloading?
How does the copy constructor differ from the assignment operator (=)?
How the programmer of a class should decide whether to declare member function or a friend function?
What is functions syntax in c++?
What is the meaning of c++?
Why struct is used in c++?
What is an html tag?
Write a program which uses Command Line Arguments
What is an arraylist c++?
What is iomanip c++?
How does c++ structure differ from c++ class?
What are separators in c++?