char *ch = "abcde";
char c[4];
how to copy 'ch' to 'c'?
Answer Posted / wade stone
#include <stdio.h>
#include <string.h>
using namespace std;
int main( )
{
char *ch = "abcde";
char c[4];
memcpy( c, ch, sizeof( c ) );
return 0;
}
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
Why would you use pointers in c++?
What is atoi?
What is the role of static keyword for a class member variable?
How can a called function determine the number of arguments that have been passed to it?
What is pure virtual function? Or what is abstract class?
what are Operators and explain with an example?
When does a 'this' pointer get created?
What is an orthogonal base class in c++?
Where must the declaration of a friend function appear?
What is #include cmath?
How to give an alternate name to a namespace?
How many different levels of pointers are there?
What is the cout in c++?
Explain virtual class?
Why is c++ not purely object oriented?