Given:
typedef type-declaration synonym;
I can see how:
typedef long unsigned int size_t;
declares size_t as a synonym for long unsigned int, however I (know it does but) can’t see exactly how:
typedef int (*F)(size_t, size_t);
declares F as a synonym for pointer to function (size_t, size_t) returning int
typedef’s two operands (type-declaration, synonym) in the first example are long unsigned int and size_t.
What are the two arguments to typedef in the declaration of F or are there perhaps overloaded versions of typedef?
If there is a relevant distinction between C and C++ please elaborate otherwise I’m primarily interested in C++ if that helps.
Type declarations using
typedefare the same as corresponding variable declarations, just withtypedefprepended. So,It’s exactly the same with function pointer types:
It’s not a “special case;” that’s just what a function pointer type looks like.