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


Please Help Members By Posting Answers For Below Questions

Do you know what is overriding?

690


What are multiple inheritances (virtual inheritance)?

676


When you overload member functions, in what ways must they differ?

678


What is cin clear () in c++?

707


What is null c++?

692






Do the parentheses after the type name make a difference with new?

748


Which programming language is best to learn first?

684


Is eclipse good for c++?

622


How to defines the function in c++?

719


Describe the process of creation and destruction of a derived class object?

739


Can manipulators fall in love?

648


When should overload new operator on a global basis or a class basis?

695


What is function overloading c++?

663


What is the full form of dos?

671


If a header file is included twice by mistake in the program, will it give any error?

647