Pointer to function

Lawrence F. Strickland larry at jc3b21.UUCP
Wed Jan 15 07:06:50 AEST 1986

In the article headed:

	From: dave at andromeda.UUCP (Dave Bloom)
	Newsgroups: net.lang.c
	Subject: Pointers to Functions
	Message-ID: <59 at andromeda.UUCP>
	Date: Thu, 9-Jan-86 13:46:33 EST

Dave Bloom says:
> Here's a good(?) question. Lets say I have this:
> main()
> {
> 	int a(), b();  /* defined somewhere else */
> 	int (*c)();    /* a pointer to a function returning int (K&R pg141) */
> 		.
> 		.
> 		.
> 	c = b;
> 	(*c)(some arguments);
> }
> Our compiler claims c is an "illegal function"
> Looks like I'm missing something. Can anyone out the lend me a hand???
> What is it that's wrong in example one? How can I declare a generic pointer
> to an int-function, set it equal to the address of a valid int function,
> and use it instead of the function????

The above program compiles correctly on a 3b2 Computer running under
System V.2.  Apparently, the problem is with the compiler used!

What are the results on other compilers out there?  Mail to me and I will
summarize and post.

-----Larry Strickland
     St. Petersburg Jr. College
     P.O. Box 13489
     St. Petersburg, FL 33733

UseNet:   ...akgua!akguc!codas!peora!ucf-cs!usfvax2!3b2bame!jc3b21!larry

More information about the Comp.lang.c mailing list