One small addition: the expression you wrote,
sizeof( x ) / sizeof( x[0] )
is used to calculate the number of items in an array. This is the same as what the
_countof
macro does in VisualStudio C++.
To summarize the three expressions and their result for
int x[8]
:
sizeof(x) size in bytes of x : 32
sizeof(x[0]) size in bytes of one item of x : 4
sizeof(x)/sizeof(x[0]) number of items in x : 8