A pointer to the function: int foo(int bar) can be declared simply: int (*myFooPtr)(int); I often choose to create a typedef: typedef int (*fooptr_t)(int); then I can: fooptr_t myFooPtr; fooptr_t yourFooPtr; Bob Ammerman RAm Systems ----- Original Message ----- From: "Brendan Moran" To: Sent: Wednesday, December 11, 2002 12:40 AM Subject: function pointer syntax in C/C++ > On most C syntax I do just fine, but function pointers are always a > head-scratcher for me. > > If I wanted to declare a pointer to this function: > > int foo(int bar); > > What would be the syntax for the declaration? > > The best I came up with was this: > > (int)(*)(int) pfoo = &foo; > > but that doesn't compile. > > Thanks, > --Brendan > > -- > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body > > -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body