array len in c++ code example
Example 1: c++ get length of array
int arr[5];
int len = sizeof(arr) / sizeof(arr[0]);
// returns 5
Example 2: array length in c++
int a[20];
int length;
length = sizeof(a) / sizeof(int);
int arr[5];
int len = sizeof(arr) / sizeof(arr[0]);
// returns 5
int a[20];
int length;
length = sizeof(a) / sizeof(int);