cplusplus:pointers_1_slides
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
cplusplus:pointers_1_slides [2021/10/19 19:20] – [Pointers 1 slides] mithat | cplusplus:pointers_1_slides [2021/10/19 19:29] (current) – [Example] mithat | ||
---|---|---|---|
Line 61: | Line 61: | ||
===== Pointer syntax basics ===== | ===== Pointer syntax basics ===== | ||
- | ===== Declaration | + | ===== Pointer declaration |
* '' | * '' | ||
* Type of data being pointed to must also be indicated. | * Type of data being pointed to must also be indicated. | ||
Line 78: | Line 78: | ||
</ | </ | ||
- | ===== Declaration | + | ===== Pointer declaration |
* You can declare more than one pointer variable at a time: | * You can declare more than one pointer variable at a time: | ||
Line 100: | Line 100: | ||
* Most environments show base addresses as [[http:// | * Most environments show base addresses as [[http:// | ||
- | ===== Assignment | + | ===== Pointer assignment |
* Declare an integer variable '' | * Declare an integer variable '' | ||
Line 111: | Line 111: | ||
{{: | {{: | ||
- | ===== Assignment | + | ===== Pointer assignment |
* Declare an integer variable '' | * Declare an integer variable '' | ||
Line 130: | Line 130: | ||
- | ===== Assignment | + | ===== Pointer assignment |
- | * Chaning | + | * Changing |
<code cpp> | <code cpp> | ||
Line 143: | Line 143: | ||
</ | </ | ||
- | ===== Initialization | + | ===== Pinter initialization |
* Local pointer variables in C++ are not automatically initialized. | * Local pointer variables in C++ are not automatically initialized. | ||
* Uninitialized pointers point to arbitrary memory. //Very dangerous.// | * Uninitialized pointers point to arbitrary memory. //Very dangerous.// | ||
Line 165: | Line 165: | ||
* '' | * '' | ||
- | ===== Pointer operators | + | ===== Operators for pointers |
- | * **address operator** ''&'' | + | * **address operator** ''&'' |
- | * **indirection** or **dereferencing operator** '' | + | * **indirection** or **dereferencing operator** '' |
===== Indirection/ | ===== Indirection/ | ||
Line 221: | Line 221: | ||
<< | << | ||
<< | << | ||
- | |||
cout << endl; | cout << endl; | ||
Line 232: | Line 231: | ||
<< | << | ||
<< | << | ||
+ | |||
return 0; | return 0; | ||
} | } | ||
</ | </ | ||
cplusplus/pointers_1_slides.1634671215.txt.gz · Last modified: 2021/10/19 19:20 by mithat