Up: Programming

C

Table of Contents

1 Pointers

A pointer is a data type that contains the address of a storage location of a variable of a particular type. We need to use * to show a variable is a pointer:

int my_int = 3;           // We could use string instead of char[] in c++
int* int_ptr = &my_int;   // Obtain pointer from value
int my_int2 = *int_ptr    // Obtain value from pointer

Whitespace before or after the * is optional.

Author: root

Created: 2024-03-23 Sat 11:44

Validate