sizeof operator on an array gives the size of the whole consecutive array, which is the number of elements times the size of each element.
So for your case 24 = 3 * 8.
The size of the pointer on your system is 8 (64-bit).
Try to print it
char *p = "Something"; std::cout << sizeof(p) << std::endl; // 8
Here is the ‘classical’ way in C of figuring out the number of elements
int size = sizeof(arr)/sizeof(arr);
- 1Why is the string immutable in c#
- 6Do you use CSS ::placeholder Pseudo Element? Why?
- 0Why onContextMenu event not working on IOS devices?
- 1Why does 0.8 + 0.4 not equal 1.2
- 0Why are C++ casts preferable to C casts
- 0post method array in 80 of 49 only taking other then missed why?
- 0Facebook page embed iframe doesn't fill container width. Why??
- 0Why is the sizeof of empty struct equal 1 ?
- 0What platforms have non 8-bit char ?
- 1Why are character literals ints in C ?