Mail Archives: djgpp/1996/09/12/09:20:39
Errors-To: postmaster AT ns1
Xref: news2.mv.net comp.os.msdos.djgpp:8521
From: rbachtel AT ghgcorp DOT ghgcorp DOT com (Jeff)
Newsgroups: comp.os.msdos.djgpp
Date: 11 Sep 1996 23:25:54 GMT
Organization: GHG Internet Services
Lines: 20
Nntp-Posting-Host: dialupline144.ghgcorp.com
Mime-Version: 1.0
X-Newsreader: WinVN 0.99.7
Dj-Gateway: from newsgroup comp.os.msdos.djgpp
Content-Type: Text/Plain; charset=US-ASCII
Content-Length: 412
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);
var
p1,p2 : ProcPTRType;
begin
p1:=goober; (Where goober is a function)
p1(13,14);
I know there is a way to do this in DJGPP 2.0, can somebody just tell me
how?
Try this:
typedef rettype (*ProcPTRType)(int,int); /* Substitute the actual return type
for rettype or void if function
has no return value. */
ProcPTRType p1,p2; /* This looks familiar! */
p1 = goober; /* Where goober is a function returning rettype (typedef'd
elsewhere. */
p1(13,14); /* Voila! */
--
Art S. Kagel, kagel AT quasar DOT bloomberg DOT com
A proverb is no proverb to you 'till life has illustrated it. -- John Keats
- Raw text -