/* 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 printf("name = %s\n", name); printf("greeting = %s\n", greeting); name[1] = 'e'; printf("name = %s\n", name); /* This statement will result in compile error. * Attempt to change target of a pointer declared as const */ greeting[1] = 'u'; return 0; }