What is the type definition of a variable x
in this code?
typedef int *f(int);
f *x;
What is the type definition of a variable x
in this code?
typedef int *f(int);
f *x;
f
is an alias for a function type that takes int
as an argument and returns an int*
.
As such it isn't particularly useful.
(If you wanted f
to be a pointer to a function that takes an int
and returns an int
, you'd have to write typedef int (*f)(int);
)
typedef int* f(int);
type f
is function with int
parameters and returning pointer to int
.
You cannot define a function using a typedef
for a function type. please see the stack overflow answer.