how to input a string into a char array cpp

C
strcpy(my_array, my_string.c_str());
Source

Also in C: