ผลต่างระหว่างรุ่นของ "Adt lab/pointers"
ไปยังการนำทาง
ไปยังการค้นหา
Jittat (คุย | มีส่วนร่วม) |
Jittat (คุย | มีส่วนร่วม) |
||
แถว 2: | แถว 2: | ||
== Pointers == | == Pointers == | ||
+ | |||
+ | In C/C++, there is a special kind of types: pointers. Pointer variables keep locations in the memory. To declare a pointer variable, we use symbol <tt>*</tt>: | ||
+ | |||
+ | type* variable; | ||
+ | |||
+ | For example, the following code declares <tt>p</tt> as a pointer to an integer. | ||
+ | |||
+ | <source lang="cpp"> | ||
+ | int* p; | ||
+ | </source> | ||
+ | |||
+ | |||
+ | Let's start by a simple example. | ||
== Pointers and arrays == | == Pointers and arrays == | ||
== Other links == | == Other links == |
รุ่นแก้ไขเมื่อ 15:41, 27 สิงหาคม 2558
- This is part of adt lab.
Pointers
In C/C++, there is a special kind of types: pointers. Pointer variables keep locations in the memory. To declare a pointer variable, we use symbol *:
type* variable;
For example, the following code declares p as a pointer to an integer.
int* p;
Let's start by a simple example.