pointers

Search IconIcon to open search

Source: samek-embedded

Pointers

  • Variables which hold memory addresses.
  • Can also be viewed as arrays .

Declaration

1
int *p_int;

Assignment

Address/pointer assignment

1
2
p_int = &another_variable;
p_int = (unsigned int *)0x20000000U;

Dereferencing

Value assignment

1
*p_int = 0xDEADBEEFU;

Shortcut

Skips declaration, goes directly to value assignment.

1
*((unsigned int *)0x20000000U) = 0xDEADBEEFU;