~cpp #include <cstdlib> #include <iostream> using namespace std; void copy(char *src, char *dest, int length ) { for(size_t i(0);i<length; i++ ) { dest[i] = src[i]; } } int main () { //char *p = malloc(sizeof(char)*100); char *p = new char[30]; copy("my_string", p, 30 ); delete [] p; return 0; }