From: test Date: Thu, 21 Jun 2018 14:19:42 +0000 (-0400) Subject: (no commit message) X-Git-Tag: 3.20190207~140 X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/579c9d18f171f66938188b4e9c2d74ba67172f78 --- diff --git a/doc/sandbox.mdwn b/doc/sandbox.mdwn index dc0aebf2d..5a2a10987 100644 --- a/doc/sandbox.mdwn +++ b/doc/sandbox.mdwn @@ -229,22 +229,22 @@ I must **emphasise** this. // more pointers -#include -using namespace std; - -int main () -{ - int firstvalue = 5, secondvalue = 15; - int * p1, * p2; - - p1 = &firstvalue; // p1 = address of firstvalue - p2 = &secondvalue; // p2 = address of secondvalue - *p1 = 10; // value pointed to by p1 = 10 - *p2 = *p1; // value pointed to by p2 = value pointed to by p1 - p1 = p2; // p1 = p2 (value of pointer is copied) - *p1 = 20; // value pointed to by p1 = 20 - - cout << "firstvalue is " << firstvalue << '\n'; - cout << "secondvalue is " << secondvalue << '\n'; - return 0; -} + #include + using namespace std; + + int main () + { + int firstvalue = 5, secondvalue = 15; + int * p1, * p2; + + p1 = &firstvalue; // p1 = address of firstvalue + p2 = &secondvalue; // p2 = address of secondvalue + *p1 = 10; // value pointed to by p1 = 10 + *p2 = *p1; // value pointed to by p2 = value pointed to by p1 + p1 = p2; // p1 = p2 (value of pointer is copied) + *p1 = 20; // value pointed to by p1 = 20 + + cout << "firstvalue is " << firstvalue << '\n'; + cout << "secondvalue is " << secondvalue << '\n'; + return 0; + }