home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / c / 16972 < prev    next >
Encoding:
Internet Message Format  |  1992-11-21  |  1.8 KB

  1. Path: sparky!uunet!olivea!charnel!rat!zeus!tcobbs
  2. From: tcobbs@zeus.calpoly.edu (Travis Cobbs)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: pointers to functions
  5. Keywords: pointers functions parameters
  6. Message-ID: <1992Nov22.000843.191255@zeus.calpoly.edu>
  7. Date: 22 Nov 92 00:08:43 GMT
  8. References: <mwm.2k0j@contessa.palo-alto.ca.us> <1992Nov6.234729.13866@koko.csustan.edu> <DU28YHO@math.fu-berlin.de>
  9. Distribution: na
  10. Organization: California Polytechnic State University, San Luis Obispo
  11. Lines: 34
  12.  
  13. In article <DU28YHO@math.fu-berlin.de> rene@hamel.uucp (Rene Mueller) writes:
  14. >In article <1992Nov6.234729.13866@koko.csustan.edu>, pendell@deneb.csustan.edu (Brian Pendell) writes:
  15. stuff deleted
  16. >|> double (*pfun) ();
  17. >|> 
  18. >|> Now, how do I call the function using the pointer? That is, the next
  19. >|> 
  20. >|> instruction should be:
  21. >|> 
  22. >|> "Call the function pointed to by pfun with parameters A and B"
  23. >|> 
  24. >|> function (A,B), in other words.
  25. >|> 
  26. >|> Any suggestion?
  27. >|> 
  28. >|> 
  29. >|>     -- Brian Pendell (pendell@ceti.csustan.edu)
  30. >
  31. >the same way you reference EVERY pointer:
  32. >(*pfun)(paramlist);
  33. >you must write (*pfun)() cause funktion calling has a higher priority than
  34. >dereferencing pointers...
  35. >
  36. >    Rene
  37.  
  38. Actually, you don't need to use (*pfun)(), you can just use pfun().  C
  39. interprets them both the same way, since there's no other logical thing to do
  40. with a function call except call the function.
  41. +-----------------------------------+------------------------------------------+
  42. |                      Travis Cobbs | When you have to kill a man, it costs    |
  43. |           tcobbs@nike.calpoly.edu | nothing to be polite.                    |
  44. |       tcobbs@morpheus.calpoly.edu |   --Winston Churchill, On formal         |
  45. |    tcobbs@polyslo.csc.calpoly.edu |     declarations of war                  |
  46. +-----------------------------------+------------------------------------------+
  47.