Interesting!! I never knew such errors existed. Maybe that's why in c++
books they write all function prototypes first and then write the
definition for the functions.
Thanks
Jonathan Shan
On Fri, 21 Jul 2006, Rupert Wood wrote:
Jonathan Shan wrote:
But the compiler still complains of conflicting types.
:
void func1(struct bucket *(*pvalid))
{
/*this code causes errors*/
*pvalid = insert_to_bucket(*pvalid);
}
If you mean that line causes a conflicting type error on the
insert_to_bucket definition -
The problem is now that you're trying to call insert_to_bucket before you've
declared it: at this point the compiler doesn't know what insert_to_bucket
is so it guesses a function signature for it and then finds out later that
it was wrong. Either declare insert_to_bucket first, i.e. add this line
struct bucket *insert_to_bucket(struct bucket *valid);
before func1, or move func1 down to after insert_to_bucket in the code.
Other than that your code should compile fine, assuming you're #including
stdio.h and stdlib.h.
Rup.