c++ - Fundamental typedef operand syntax -
c++ - Fundamental typedef operand syntax -
given:
typedef type-declaration synonym;
i can see how:
typedef long unsigned int size_t;
declares size_t
synonym long unsigned int
, (know but) can't see exactly how:
typedef int (*f)(size_t, size_t);
declares f
synonym pointer function (size_t, size_t) returning int
typedef's 2 operands (type-declaration, synonym)
in first illustration long unsigned int
, size_t
.
what 2 arguments typedef in declaration of f
or there perhaps overloaded versions of typedef?
if there relevant distinction between c , c++ please elaborate otherwise i'm interested in c++ if helps.
type declarations using typedef
same corresponding variable declarations, typedef
prepended. so,
int x; // declares variable named 'x' of type 'int' typedef int x; // declares type named 'x' 'int'
it's same function pointer types:
int(*f)(size_t); // declares variable named f of type 'int(*)(size_t)' typedef int(*f)(size_t); // declares type named 'f' 'int(*)(size_t)'
it's not "special case;" that's function pointer type looks like.
c++ c typedef
Comments
Post a Comment