Pointers and Arrays

Lesson overview

Topics covered: Array decay, pointer arithmetic, array of pointers.

Arrays

Declaration: int arr[10]; - array of 10 integers
Initialization: int arr[5] = {1, 2, 3, 4, 5};
Access: arr[0] - first element, arr[4] - fifth
Size: use sizeof(arr) / sizeof(arr[0]) to get count

int numbers[] = {10, 20, 30, 40, 50};

Article author: Arthur Isaev