diff options
author | test <test@web> | 2018-06-21 10:19:42 -0400 |
---|---|---|
committer | admin <admin@branchable.com> | 2018-06-21 10:19:42 -0400 |
commit | 579c9d18f171f66938188b4e9c2d74ba67172f78 (patch) | |
tree | fbac9d4ae22c47cc236086dc1de9850c3d89d0a1 /doc/sandbox.mdwn | |
parent | 43033a2a6e80a67f29b78d4a6ecfb072ea6165e0 (diff) | |
download | ikiwiki-579c9d18f171f66938188b4e9c2d74ba67172f78.tar ikiwiki-579c9d18f171f66938188b4e9c2d74ba67172f78.tar.gz |
Diffstat (limited to 'doc/sandbox.mdwn')
-rw-r--r-- | doc/sandbox.mdwn | 38 |
1 files changed, 19 insertions, 19 deletions
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 <iostream> -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 <iostream> + 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; + } |