Hi Ricky, Interesting, I just tried both your way and mine and they seem to work. I've always just done it the way I said.. #include typedef int (*FooPtrType)(int); int foo(int bar) { printf("Foo: %d\r\n", bar); return 0; } main() { FooPtrType pFoo1 = foo; FooPtrType pFoo2 = &foo; (*pFoo1)(1); pFoo2(2); } I like to use mine because it makes it explicit that you are taking the address of the function. Also there is no need to dereference the pointer when calling the function. This just makes reading the code that much more difficult. Assuming you name you pointers in a distinct way.. Guess its just preferences. Cheers, Ash. --- Ashley Roll Digital Nemesis Pty Ltd www.digitalnemesis.com Mobile: +61 (0)417 705 718 > -----Original Message----- > From: pic microcontroller discussion list > [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of Ricky Hussmann > Sent: Wednesday, 11 December 2002 4:41 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: function pointer syntax in C/C++ > > I'm not quite sure this is right. As far as I know, you don't > need the "&" > before the function name. It may still work, I haven't tried it. > > > /* This will assign the address of the function foo to p */ > > /* The function name itself is actually a pointer to the function */ > > p = foo; > > > > /* Now using the function pointer we can call the function foo */ > > answer = (*p) (4); -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body