🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c.moderated
Article #2496

Re: Pointers to functions

#2496
From: Herman Rubin
Date: Thu, 04 Apr 1996 01:10
20 lines
1441 bytes
In article <4jol6u$1sn@solutions.solon.com>,
Lloyd Hopkins  <Lloyd@bomber.demon.co.uk> wrote:
>Hi,

>I've recently been working my way through K&R (second edition) and whilst
>most of it is clear enough, I'm having trouble with 5.11, 5.12 (Pointers to
>Functions, Complicated Declarations) and I thought I'd ask here to see
>if anyone can help.  The main thing which is puzzling me, is just why
>you'd want to create a pointer to a function?

A good example is where a subroutine uses buffers, which can be
refilled as needed.  The buffer descriptors and the functions
refilling them are unknown to the subroutine at compile time,
and are to be filled in by the main program, or higher subroutine
at run time.  These may also be changed at run time, so the only
locations in the subroutine are pointers to the buffers and
refill functions.
-- 
Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907-1399
hrubin@stat.purdue.edu	 Phone: (317)494-6054	FAX: (317)494-0558
Technical Details
Message-ID: <4jv7ih$d6n@solutions.solon.com>
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
References: <4jol6u$1sn@solutions.solon.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
From: hrubin@stat.purdue.edu (Herman Rubin)
Newsgroups: comp.lang.c.moderated
Subject: Re: Pointers to functions
Date: 3 Apr 1996 19:10:41 -0600
Organization: Purdue University Statistics Department
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4jv7ih$d6n@solutions.solon.com>
References: <4jol6u$1sn@solutions.solon.com>
NNTP-Posting-Host: solutions.solon.com