Implementation
It is the responsibility of compilers to implement the sizeof
operator correctly for each target platform. In many cases, there will be an official Application Binary Interface (ABI) document for the platform, specifying formats, padding, and alignment for the data types, to which the compiler must conform. In most cases, sizeof
is a compile-time operator, which means that during compilation sizeof
expressions get replaced by constant result-values. However, sizeof
applied to a variable length array, introduced in C99, requires computation during program execution.
Read more about this topic: Sizeof