Looks like by actual size, you mean the elements of the array. Since sizeof(countSize)
gives the size of the array in bytes, all you need is to divide it by the size of each element like this:
printf("%zu\n", sizeof(countSize) / sizeof(int));
Or better, use sizeof(countSize[0]
as the type of the array may vary:
printf("%zu\n", sizeof(countSize) / sizeof(countSize[0]));
You got expected result when working with char
arrays because sizeof(char)
is always 1
.