In C, the sizeof pseudo-function actually evaluates at compile time, not at run time. Most compilers treat it as a compile time directive (much like a #define) that resolves to a lookup into the symbol table for the referenced symbol that returns the target object's size in bytes as stored in the symbol table.
There are a number of public domain C compilers. I'd recommend checking out
gcc from gnu to see a nice clean implementation.
-PatP