/* Example of c-style strings. Array declaration vs. a pointer attached * to a string literal */ #include int main() { char name[20] = "Marvin Dipwart"; const char * greeting = "Hello"; // const guarantees that the // compiler will not allow attempt // to change target cout << "name = " << name << '\n'; cout << "greeting = " << greeting << '\n'; name[1] = 'e'; cout << "name = " << name << '\n'; /* This statement will result in compile error. * Attempt to change target of a pointer declared as const */ greeting[1] = 'u'; return 0; }