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
On throwing an exception by the animal constructor in p = new animalq, can memory leak occur?
What are static and dynamic type checking?
What is a vector c++?
Why c++ is so important?
What is virtual destructor ans explain its use?
What is the role of copy constructor in copying of thrown objects?
What is c++ best used for?
If we want that any wildcard characters in the command line arguments should be appropriately expanded, are we required to make any special provision? If yes, which?
What is a .h file c++?
How is objective c different from c++?
What is difference between c++ and c ++ 14?
What is the full name of logo?
What is a list c++?
What is a syntax in c++?
What is the best book for c++ beginners?