User Tools

Site Tools


cplusplus:pointers_2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
cplusplus:pointers_2 [2019/03/11 19:51]
mithat [Calling functions by reference]
cplusplus:pointers_2 [2019/03/11 19:53] (current)
mithat [Pointer to constant data]
Line 146: Line 146:
  
  
-<WRAP center ​round tip 90%>+<WRAP center tip 90%>
 One way to remember this is //"''​const''​ modifies the thing immediately following it."// One way to remember this is //"''​const''​ modifies the thing immediately following it."//
  
 In the case of: In the case of:
 <code c++>int *const myPtr = &​x;</​code>​ <code c++>int *const myPtr = &​x;</​code>​
-''​const''​ modifies ''​myPtr'',​ meaning the value of ''​myPtr''​ is constant. In the case of:+''​const''​ modifies ''​myPtr'',​ meaning the value of ''​myPtr''​ is constant. 
 + 
 +In the case of:
 <code c++>​const int *myPtr = &​x;</​code>​ <code c++>​const int *myPtr = &​x;</​code>​
 ''​const''​ modifies ''​int'',​ meaning the value of the ''​int''​ is constant. ''​const''​ modifies ''​int'',​ meaning the value of the ''​int''​ is constant.
cplusplus/pointers_2.txt · Last modified: 2019/03/11 19:53 by mithat