I would like your opinion on this;
are the following two declarations equivalent ?
If not, why ?
1)
void (*f(struct t *p, longint n))(void);
and
2)
void *f(struct t *p, longint n)(void);
I need to declare a function with two parameters: a pointer to a struct tagged t, and a long int n. The function takes no parameters and has no return value.
My solution was 1), but in a C coursebook I found 2), which I don't like as it seems more confusing to me.
Your view would be appreciated. Cheers
I need to declare a function with two parameters: a pointer to a struct tagged t, and a long int n. The function takes no parameters and has no return value.
I need to declare a function with two parameters: a pointer to a struct tagged t, and a long int n. The function takes no parameters and has no return value.
My solution was 1), but in a C coursebook I found 2), which I don't like as it seems more confusing to me.
I think you have read the book wrong. Like Zhuge implied, this makes no sense.
thanks for the answers.
Yes, it was late at night and the description I wrote was wrong. I needed the function with those two parameters to return a pointer to a function with no parameters and no return value.
It looks like the solution in the book is wrong
thanks again