C programming question
Juan J. Martínez
reidrac at usebox.net
Wed Jul 6 16:36:21 GMT 2005
El lun, 04-04-2005 a las 11:43 -0700, Matt escribió:
> [...]
> Can someone break down these declarations (if that's what they are)? Is
> this a form of typecasting? Thanks for your help.
Those are declarations of pointers to functions.
/* real function */
void dumb(int a) { return a; }
...
/* here follows a declaration of func pointer */
int (*func_ptr)(int);
int a;
/* assign it */
func_ptr=dumb;
/* use it */
a=func_ptr(123);
Any good book about C should cover this. Look for OOP in C also, it's
frequent use pointers to functions + structs to add classes to C.
regards,
Juanjo
--
Desarrollo y sistemas: http://www.usebox.net/
Página Personal: http://www.usebox.net/jjm/
More information about the freebsd-hackers
mailing list