With the __typeof__() operator, the compiler lets you specify the data type of an expression. Listing: Example of __typeof__() and typeof() Operators shows an example.
__typeof__( expression)
where expression is any valid C expression or data type. Because the compiler translates a __typeof__() expression into a data type, you can use this expression wherever a normal type would be specified.
Like the sizeof() operator, __typeof__() is only evaluated at compile time, not at runtime.
char *cp; int *ip; long *lp; __typeof__(*ip) i; /* equivalent to "int i;" */ __typeof__(*lp) l; /* equivalent to "long l;" */ #pragma gcc_extensions on typeof(*cp) c; /* equivalent to "char c;" */