C++ examples for Data Type:char array
Defines a string literal and uses it twice.
#include <iostream> using namespace std; #define MYNAME "test test" int main()/*from w ww . ja v a2 s . c om*/ { char name[]=MYNAME; cout << "My name is " << name << "\n"; // Prints the array. cout << "My name is " << MYNAME << "\n"; // Prints the // defined literal. return 0; }