User Tools

Site Tools


cplusplus:pointers_1

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
cplusplus:pointers_1 [2018/02/24 20:50] – [Pointers in the abstract] mithatcplusplus:pointers_1 [2018/02/24 20:51] – [Pointer syntax basics] mithat
Line 133: Line 133:
 Pointer variables in C++ are not automatically initialized. This means that a pointer variable declaration along the lines of Pointer variables in C++ are not automatically initialized. This means that a pointer variable declaration along the lines of
 <code cpp>double *myPtr;</code> <code cpp>double *myPtr;</code>
-leaves the pointer pointing to an arbitrary memory location. This is dangerous because poking your fingers into arbitrary memory locations is a good way to corrupt your program's memory.+leaves the pointer pointing to an arbitrary memory location. This is dangerous because poking your fingers into arbitrary memory locations is a good way to corrupt your program's memory or create other headaches.
  
 Pointer variables can be initialized when declared. It is good programming practice to always initialize pointers so they do not accidentally point to unknown memory locations. The code below initializes the value of the pointer variable in the declaration: Pointer variables can be initialized when declared. It is good programming practice to always initialize pointers so they do not accidentally point to unknown memory locations. The code below initializes the value of the pointer variable in the declaration:
cplusplus/pointers_1.txt · Last modified: 2019/03/28 16:24 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki