home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!charnel!rat!zeus!tcobbs
- From: tcobbs@zeus.calpoly.edu (Travis Cobbs)
- Newsgroups: comp.lang.c
- Subject: Re: pointers to functions
- Keywords: pointers functions parameters
- Message-ID: <1992Nov22.000843.191255@zeus.calpoly.edu>
- Date: 22 Nov 92 00:08:43 GMT
- References: <mwm.2k0j@contessa.palo-alto.ca.us> <1992Nov6.234729.13866@koko.csustan.edu> <DU28YHO@math.fu-berlin.de>
- Distribution: na
- Organization: California Polytechnic State University, San Luis Obispo
- Lines: 34
-
- In article <DU28YHO@math.fu-berlin.de> rene@hamel.uucp (Rene Mueller) writes:
- >In article <1992Nov6.234729.13866@koko.csustan.edu>, pendell@deneb.csustan.edu (Brian Pendell) writes:
- stuff deleted
- >|> double (*pfun) ();
- >|>
- >|> Now, how do I call the function using the pointer? That is, the next
- >|>
- >|> instruction should be:
- >|>
- >|> "Call the function pointed to by pfun with parameters A and B"
- >|>
- >|> function (A,B), in other words.
- >|>
- >|> Any suggestion?
- >|>
- >|>
- >|> -- Brian Pendell (pendell@ceti.csustan.edu)
- >
- >the same way you reference EVERY pointer:
- >(*pfun)(paramlist);
- >you must write (*pfun)() cause funktion calling has a higher priority than
- >dereferencing pointers...
- >
- > Rene
-
- Actually, you don't need to use (*pfun)(), you can just use pfun(). C
- interprets them both the same way, since there's no other logical thing to do
- with a function call except call the function.
- +-----------------------------------+------------------------------------------+
- | Travis Cobbs | When you have to kill a man, it costs |
- | tcobbs@nike.calpoly.edu | nothing to be polite. |
- | tcobbs@morpheus.calpoly.edu | --Winston Churchill, On formal |
- | tcobbs@polyslo.csc.calpoly.edu | declarations of war |
- +-----------------------------------+------------------------------------------+
-