/* Example of c-style strings. Array declaration vs. a pointer attached * to a string literal */ #include using namespace std; int main() { char name[20] = "Marvin Dipwart"; char * greeting = "Hello"; // points to a constant segment // of memory cout << "name = " << name << '\n'; cout << "greeting = " << greeting << '\n'; name[1] = 'e'; cout << "name = " << name << '\n'; /* This statement will compile, but a runtime error will occur */ greeting[1] = 'u'; return 0; }