cplusplus:pointers_2
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
cplusplus:pointers_2 [2016/03/05 22:24] – [Calling functions by reference] mithat | cplusplus:pointers_2 [2016/03/05 22:35] – [Constant pointer to constant data] mithat | ||
---|---|---|---|
Line 89: | Line 89: | ||
void cubeByReference(int *nPtr) | void cubeByReference(int *nPtr) | ||
{ | { | ||
- | *nPtr = *nPtr * *nPtr * *nPtr; | + | *nPtr = (*nPtr) * (*nPtr) * (*nPtr); // parenthesis for readability |
} | } | ||
</ | </ | ||
Line 162: | Line 162: | ||
</ | </ | ||
- | + | One way to remember this is "const modifies the thing immediately following it." In the case of <code c++>int *const myPtr = & | |
- | + |
cplusplus/pointers_2.txt · Last modified: 2019/03/28 16:55 by mithat