The sizeof() Operator

When the GCC extensions setting is on, the sizeof() operator computes the size of function and void types. In both cases, the sizeof() operator evaluates to 1. The ISO/IEC 9899-1990 C Standard ("C90") does not specify the size of the void type and functions. Using the sizeof() operator with void and function types shows an example.

Listing 1. Using the sizeof() operator with void and function types
int f(int a)
{
    return a * 10;
}

void g(void)
{
    size_t voidsize = sizeof(void); /* voidsize contains 1 */
    size_t funcsize = sizeof(f); /* funcsize contains 1 */

}