MinnisotaFreezing
Programmer
I understand how sizeof() can give you the number of elements in an array when they are all the same size, as in
int array[] = { 1, 2, 3, 4, 5 };
size_t sizearr =
sizeof( array ) / sizeof( array[0] );
(Lifted from the MSDN)
But why does it work when the elements are different sizes, like:
sysmetrics[] =
{TEXT("STEVE", TEXT("JACOBE", TEXT("CHRISTOPHER"};
size_t sizearr = sizeof(array)/sizeof(array[0]);
where size_t would = 3?
(Lifted from Programming Windows"
int array[] = { 1, 2, 3, 4, 5 };
size_t sizearr =
sizeof( array ) / sizeof( array[0] );
(Lifted from the MSDN)
But why does it work when the elements are different sizes, like:
sysmetrics[] =
{TEXT("STEVE", TEXT("JACOBE", TEXT("CHRISTOPHER"};
size_t sizearr = sizeof(array)/sizeof(array[0]);
where size_t would = 3?
(Lifted from Programming Windows"