Function pointers.. help!

Lloyd Kremer kremer at cs.odu.edu
Sat Oct 14 02:28:50 AEST 1989


In article <3005 at ndsuvax.UUCP> nebakke at ndsuvax.UUCP (Jeff Bakke) writes:

>say I have a function pointer defined:
>void (*border_proc)();  
>Ok, now I want a function to be called as
>Assign_border(myfunction);
>Where myfunction is a function name.
>Now the assign_border function
>is declared as 
>void Assign_border(void (*user_border)()){
>
>   border_proc = user_border;
>}
>
>Now, to me, this seems alright, but to the  Turbo c 2.0 compiler, it
>says that a Storage class is required.


The code seems basically all right.  Maybe the Assign_border function doesn't
know what border_proc is.  This could be the case if border_proc's definition
were in another file or occurred before the Assign_border function.

Try
	extern void (*border_proc)();
	/* extern could be the missing storage class */
	border_proc = user_border;

as the contents of Assign_border().

-- 
					Lloyd Kremer
					...!uunet!xanth!kremer
					Have terminal...will hack!



More information about the Comp.lang.c mailing list