指针类型
int32_t a; <span style="line-height: 1.5;">/* declaration af a variable a.</span><span style="line-height: 1.5;">Allocates space in memory. */</span>
*a_ptr = 5; /* a gets the value 5 */
int32_t b = *a_ptr; /* declares a new variable which
gets the value of a, in this
case b gets the value 5 */
int *ptr1; /* Regular pointer pointing to an int */
const int *ptr2; /* Regular pointer pointing to a constant int */
int *const ptr3; /* Constant pointer pointing to an int */
const int *const ptr4; /* Constant pointer pointing to a constant int*/
data *a_ptr; /* declares a pointer to a
variable of type data */
(*a_ptr).x = 3; /* a gets the value 3. This is
the cumbersome way to do it. */
a_ptr->x = 4; /* a gets the value 4. This is the
common way to do it. */
int32_t array[5];
int32_t *pointer;
pointer = &array[0];
|