// Illustrates pointer access to C-style trings. #include #include // Corresponds to in a C program. void g(){ char s1[6] = "Knold", s2[4] = "Tot", *ps1 = &s1[0], *ps2 = &s2[0]; ps1 = ps2; // OK here. Both ps1 and ps2 point at Tot. ps2[1] = 'u'; // Affects both ps1 and ps2 std::cout << ps1 << " og " << ps2 << std::endl; // Tut og Tut } int main(){ g(); }