diff options
Diffstat (limited to 'c++.html.markdown')
| -rw-r--r-- | c++.html.markdown | 9 | 
1 files changed, 9 insertions, 0 deletions
| diff --git a/c++.html.markdown b/c++.html.markdown index 6a3fdb5b..dd4ba055 100644 --- a/c++.html.markdown +++ b/c++.html.markdown @@ -228,10 +228,19 @@ cout << myString + myOtherString; // "Hello World"  cout << myString + " You"; // "Hello You" +// C++ string length can be found from either string::length() or string::size() +cout << myString.length() + myOtherString.size(); // Outputs 11 (= 5 + 6). +  // C++ strings are mutable.  myString.append(" Dog");  cout << myString; // "Hello Dog" +// C++ can handle C-style strings with related functions using cstrings +#include <cstring> + +char myOldString[10] = "Hello CPP"; +cout << myOldString; +cout << "Length = " << strlen(myOldString); // Length = 9  /////////////  // References | 
