diff options
author | Marno007 <Marno007@web> | 2018-03-22 06:12:40 -0400 |
---|---|---|
committer | admin <admin@branchable.com> | 2018-03-22 06:12:40 -0400 |
commit | 7e39bb4dad342afaec1415408749a406ad507ba8 (patch) | |
tree | 00a13c0cb7410bf1c3ce9445801bff424db20178 /doc | |
parent | 0b81eac00e46b1c918ddd871a4a4380c89c331f7 (diff) | |
download | ikiwiki-7e39bb4dad342afaec1415408749a406ad507ba8.tar ikiwiki-7e39bb4dad342afaec1415408749a406ad507ba8.tar.gz |
Diffstat (limited to 'doc')
-rw-r--r-- | doc/sandbox.mdwn | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/sandbox.mdwn b/doc/sandbox.mdwn index 7a755ee02..dc0aebf2d 100644 --- a/doc/sandbox.mdwn +++ b/doc/sandbox.mdwn @@ -226,3 +226,25 @@ Testing. Test. 試験として書き込みします。 test 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; +} |