Lecture 3 - Slide 12 : 27
Strings - examples
We show simple examples that illustrate the value semantics of C++ strings and the pointer semantics of C-style strings
knold-tot.cc
The Knold & Tot example from section 20.3.6 of 3rd version of the C++ book.
knold-tot-c-like-1.cc
The Knold & Tot example with char*.
knold-tot-c-like-2.cc
The Knold & Tot example with char[].
knold-tot-c-like-3.cc
The Knold & Tot example with strcpy from <cstring>.
knold-tot-c-like-4.cc
The Knold & Tot example with char* aliasing.
string-ex.cc
Illustration of various basic string operations in C++.
string-ex-cpp11.cc
Same - with C++ initializations.
string-ex-output
Program output.
Go to exercise
String functions