#include#include int main() { std::string s = "Hello World!"; const char* c_str = s.c_str(); std::cout << c_str << std::endl; return 0; }
#includeThis code initializes a char array with the value "Hello World!" using the strcpy() function from the C-style string library. The array is then printed to the console using cout. This example demonstrates how a C-style string can be initialized and manipulated without using the string class. Package/library: Standard Library.#include int main() { char buffer[100]; std::strcpy(buffer, "Hello World!"); std::cout << buffer << std::endl; return 0; }