summaryrefslogtreecommitdiffhomepage
path: root/c++.html.markdown
diff options
context:
space:
mode:
Diffstat (limited to 'c++.html.markdown')
-rw-r--r--c++.html.markdown4
1 files changed, 2 insertions, 2 deletions
diff --git a/c++.html.markdown b/c++.html.markdown
index 6d039c33..663fa45e 100644
--- a/c++.html.markdown
+++ b/c++.html.markdown
@@ -263,10 +263,10 @@ std::string& fooRef = foo; // This creates a reference to foo.
fooRef += ". Hi!"; // Modifies foo through the reference
std::cout << fooRef; // Prints "I am foo. Hi!"
+std::cout << &fooRef << '\n'; // Prints the address of foo
// Doesn't reassign "fooRef". This is the same as "foo = bar", and
// foo == "I am bar"
// after this line.
-std::cout << &fooRef << '\n'; // Prints the address of foo
fooRef = bar;
std::cout << &fooRef << '\n'; // Still prints the address of foo
std::cout << fooRef << '\n'; // Prints "I am bar"
@@ -840,7 +840,7 @@ void doSomethingWithAFile(const std::string& filename)
// manage the lifetime of the object being pointed to without ever needing to explicitly delete
// the object. The term itself simply describes a set of pointers with the
// mentioned abstraction.
-// Smart pointers should preferred over raw pointers, to prevent
+// Smart pointers should be preferred over raw pointers, to prevent
// risky memory leaks, which happen if you forget to delete an object.
// Usage of a raw pointer: