Date: Wed, 6 Jul 2005 13:56:20 -0400 (EDT) From: Michael Shalayeff <mickey@lucifier.net> To: "Juan J. [Mart_nez]" <reidrac@usebox.net> Cc: freebsd-hackers@FreeBSD.ORG, misc@openbsd.org, Matt <mhersant@comcast.net> Subject: Re: C programming question Message-ID: <200507061756.j66HuKNJ018494@lucifier.net> In-Reply-To: <1120667769.8695.10.camel@localhost.localdomain> from "Juan J. [Mart_nez]" at "Jul 6, 2005 06:36:09 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
Making, drinking tea and reading an opus magnum from Juan J. [Mart_nez]:
[Charset ISO-8859-1 unsupported, filtering to ASCII...]
> El lun, 04-04-2005 a las 11:43 -0700, Matt escribis:
> > [...]
> > 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; }
warning: `return' with a value, in function returning void
> ...
>
> /* here follows a declaration of func pointer */
> int (*func_ptr)(int);
> int a;
>
> /* assign it */
> func_ptr=dumb;
warning: assignment from incompatible pointer type
> /* 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.
perhaps you should read that book first (:
cu
--
paranoic mickey (my employers have changed but, the name has remained)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200507061756.j66HuKNJ018494>
