From 87b765eb5d6746eb819dcfa6c0a68046a321e1ff Mon Sep 17 00:00:00 2001 From: Jidong Xiao Date: Tue, 12 Sep 2023 13:34:27 -0400 Subject: [PATCH] adding line breaks --- lectures/04_pointers/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lectures/04_pointers/README.md b/lectures/04_pointers/README.md index 6049f86..e519492 100644 --- a/lectures/04_pointers/README.md +++ b/lectures/04_pointers/README.md @@ -112,15 +112,15 @@ cout << x << " " << y << endl; - Like the int type, pointers are not default initialized. We should assume it’s a garbage value, leftover from the previous user of that memory. -- Pointers that don’t (yet) point anywhere useful are often explicitly assigned to NULL. - – NULL is equal to the integer 0, which is a legal pointer value (you can store NULL in a pointer variable). - – But NULL is not a valid memory location you are allowed to read or write. If you try to dereference or +- Pointers that don’t (yet) point anywhere useful are often explicitly assigned to NULL. + - NULL is equal to the integer 0, which is a legal pointer value (you can store NULL in a pointer variable). + - But NULL is not a valid memory location you are allowed to read or write. If you try to dereference or follow a NULL pointer, your program will immediately crash. You may see a segmentation fault, a bus error, or something about a null pointer dereference. - – NOTE: In C++11, we are encouraged to switch to use **nullptr** instead of NULL or 0, to avoid some + - NOTE: In C++11, we are encouraged to switch to use **nullptr** instead of NULL or 0, to avoid some subtle situations where NULL is incorrectly seen as an int type instead of a pointer. For this course we will assume NULL and nullptr are equivalent. - – We indicate a NULL or nullptr value in diagrams with a slash through the memory location box. + - We indicate a NULL or nullptr value in diagrams with a slash through the memory location box. - Comparing a pointer to NULL is very useful. It can be used to indicate whether or not a pointer variable is pointing at a useable memory location. For example, ```cpp