Static array:

int array[10];

int n1 = sizeof(array)/sizeof(int); // number of array elements

int n2 = sizeof(array); // length of array in bytes

Dynamic array:

int nSize = 10;

int* pArray = new int[nSize];

int n1 = nSize; // number of array elements

int n2 = nSize * sizeof(int); // length of array in bytes

int array[10];

int n1 = sizeof(array)/sizeof(int);

int n2 = sizeof(array); // length of array in bytes

Dynamic array:

int nSize = 10;

int* pArray = new int[nSize];

int n1 = nSize; // number of array elements

int n2 = nSize * sizeof(int); // length of array in bytes