Array
Note: size cannot be changed
Declare
<type> arrName[size] = {2, 5, 7, 8};
int arrName[4] = {2, 5, 7, 8};Size
sizeof(arr)/sizeof(*arr)
// or
sizeof(arr)/sizeof(dataTypeOfArr)Note: this will not work inside of a function because, array decay into pointers
Note: only works with stack allocated arrays
// best way to know the size is to predefine the size like this
static const int size = 5;