delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/09/12/02:50:04

Date: Thu, 12 Sep 1996 09:36:56 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Jeff <rbachtel AT ghgcorp DOT ghgcorp DOT com>
Cc: djgpp AT delorie DOT com
Subject: Re: function pointers
In-Reply-To: <517hq2$hqp@news.ghgcorp.com>
Message-Id: <Pine.SUN.3.91.960912093315.15096L-100000@is>
Mime-Version: 1.0

On 11 Sep 1996, Jeff wrote:

> I wish to create a variable, such that a function (with parameters)
> can be assigned to it.
> 
> For example, in TurboP7.0:
> type
>     ProcPTRType=procedure(x,y : integer);

	/* Declare `procedure' to be a pointer to a function which gets
	   two integers and returns nothing.  */
	void (*procedure)(int, int);

	/* Use it.  */
	procedure = my_proc;

	/* Call it.  */
	(*my_proc)(x, y);

Actually, you may say just "my_proc(x, y)", but some compilers out there 
didn't hear about ANSI C standard which allows this (DJGPP *does* know 
about this).

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019