typedef double (*sizefn_t) (double *);
sizefn_t sizefn = userSizeFace;

Dear friends:
Could you pleaset tell me what is the meaning of the code, what does sizefn_t represent. what is the meaning typedef.

4 Years
Discussion Span
Last Post by deceptikon

sizefn_t is a typedef for a pointer to a function. The typedef simplifies the syntax for said pointers because otherwise the syntax is pretty awkward:

// Declare a pointer to function and point it to useSizeFace()
double (*sizefn)(double*) = userSizeFace;

All the typedef does is wrap the awkwardness into a nice little package that you can then use directly just like any type:

// Hide the function pointer syntax behind a typedef
typedef double (*sizefn_t)(double*);

// Exactly the same as the first declaration for sizefn
sizefn_t sizefn = userSizeFace;
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.