cplusplus:pointers_2
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
cplusplus:pointers_2 [2016/03/05 22:41] – [Pointer to constant data] mithat | cplusplus:pointers_2 [2019/03/28 16:55] (current) – mithat | ||
---|---|---|---|
Line 23: | Line 23: | ||
<file cpp function-with-pointer.cpp> | <file cpp function-with-pointer.cpp> | ||
- | /** Demostrates | + | /** Demonstrates |
#include < | #include < | ||
using namespace std; | using namespace std; | ||
Line 54: | Line 54: | ||
===== Calling functions by reference ===== | ===== Calling functions by reference ===== | ||
- | Pointers can be used to implement //call-by-reference// in functions. The '' | + | Pointers can be used to implement //passing |
<code cpp> | <code cpp> | ||
Line 63: | Line 63: | ||
</ | </ | ||
- | In the function above, '' | + | In the function above, '' |
<file cpp cube-by-reference.cpp> | <file cpp cube-by-reference.cpp> | ||
- | /** Cube a variable using call-by-reference with a pointer. */ | + | /** Cube a variable using pass by reference with a pointer. */ |
#include < | #include < | ||
using namespace std; | using namespace std; | ||
Line 88: | Line 88: | ||
</ | </ | ||
- | <WRAP center | + | <WRAP center tip 90%> |
- | I (and many other programmers) | + | I feel pointers are much better |
</ | </ | ||
Line 146: | Line 146: | ||
- | <WRAP center | + | <WRAP center tip 90%> |
One way to remember this is //"'' | One way to remember this is //"'' | ||
In the case of: | In the case of: | ||
<code c++>int *const myPtr = & | <code c++>int *const myPtr = & | ||
- | '' | + | '' |
+ | |||
+ | In the case of: | ||
<code c++> | <code c++> | ||
'' | '' |
cplusplus/pointers_2.1457217687.txt.gz · Last modified: 2016/03/05 22:41 by mithat