C++ examples for Data Type:char array
The strcpy_s() function copies the entire contents of one string into a designated buffer.
#include <iostream> #include <string.h> int main() /*from w w w.j a va2 s . c o m*/ { char string1[] = "Free the bound periodicals!"; char string2[80]; strcpy_s(string2, string1); std::cout << "String1: " << string1 << std::endl; std::cout << "String2: " << string2 << std::endl; return 0; }