🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2140

ptr to a function?

#2140
From: HALLS BRADLEY F
Date: Sat, 26 Sep 1992 05:25
36 lines
1504 bytes
Dear c-gurus:

  Please forgive me for asking such an ignorant question on my first post,
but I'm in a bit of a jam. I need to finish a program that requires me (I
think) to pass the address of a function to another function. I want to do
something like:

func1 (float X, float (*funcptr) (float Y));	/* declaration for func1   */
						/* passed a float and	   */
						/* addr of func2, which	   */
						/* returns and is passed   */
						/* a float.		   */
...

funcptr = &func2 (float Y);			/* funcptr = addr of func2 */

...

Z = *funcptr (float Y);				/* call the func at addr   */
 						/* *funcptr		   */

I know the syntax is all screwed up, but if you can tell what I'm after,
any help would be greatly appreciated. Thanks in advance.

--Brad.
 

-- 
^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^
Brad Halls                                "Still looking for witty quote."
Computer Science Grad Student              -me         
Oakland University
Rochester, Michigan
bfhalls@vela.acs.oakland.edu

^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^
Technical Details
Message-ID: <1992Sep26.052509.16850@vela.acs.oakland.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!wupost!uwm.edu!ux1.cso.uiuc.edu!m.cs.uiuc.edu!vela!bfhalls

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!wupost!uwm.edu!ux1.cso.uiuc.edu!m.cs.uiuc.edu!vela!bfhalls
From: bfhalls@vela.acs.oakland.edu (HALLS BRADLEY F)
Subject: ptr to a function?
Message-ID: <1992Sep26.052509.16850@vela.acs.oakland.edu>
Organization: Oakland University, Rochester MI.
Date: Sat, 26 Sep 1992 05:25:09 GMT
Lines: 36