cplusplus:pointers_1
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
cplusplus:pointers_1 [2018/02/24 20:50] – [Pointers in the abstract] mithat | cplusplus: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> | <code cpp> | ||
- | 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' | + | 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' |
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