Use sizeof. That's what it's there for!

Bearing in mind that structs often incorporate padding, it's 
not easy to find their size. I suppose you could initialise 
an area of memory to 0x00, write a struct over it, and see 
which bytes contain bits that have changed; then do the same 
but initialising to 0xff; then deduce the size of the struct 
from the results. But it's much easier and more reliable to 
use sizeof.

David

Reply via email to