Are you unable to use C sizeof operator as expected in pre-processor macros?

If you are trying to use the C programming language’s sizeof operator in a C pre-processor macro and find that you are unable to use it as expected and you see compiler errors (actually C pre-processor (CPP) errors), you are really seeing expected behavior. The sizeof operator works only during compile time and the sizes of structures are only known at compile time and it is not an operator supported by the C pre-processor.


Leave a Reply

Your email address will not be published. Required fields are marked *