Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site inuxh.UUCP Path: utzoo!linus!philabs!cmcl2!floyd!harpo!eagle!mhuxl!ihnp4!inuxc!inuxh!stevens From: stevens@inuxh.UUCP Newsgroups: net.unix Subject: Re: functions returning pionters to functions Message-ID: <247@inuxh.UUCP> Date: Fri, 16-Dec-83 09:47:11 EST Article-I.D.: inuxh.247 Posted: Fri Dec 16 09:47:11 1983 Date-Received: Sat, 17-Dec-83 08:27:46 EST References: <2430@azure.UUCP> <126@ccivax.UUCP> Organization: AT&T Consumer Products Div., Indianapolis Lines: 21 > The declaration 'int (*ptr)()' defines 'ptr' as a pointer to > an integer function. What you want to do is replace 'ptr' with > your function definition of 'getroutine(name, table)', thus > giving 'int (*(getroutine(name, table)))()' which defines > getroutine as a function with two arguements which returns a > pointer to an integer function (or function that returns an > integer). > > Note that 'ptr' was replaced by '(getroutine(name, table))'. > The enclosing parenthesis are necessary to bind the arguements > to getroutine before the * (pointer binding) is applied. No, the parentheses around '(getroutine(name, table))' are not required. function arguments `()' bind more tightly than pointer dereferencing `*'. (K & R, p. 49 [the page my K & R falls open to]). -- Scott Stevens AT&T Consumer Products Laboratories Indianapolis, Indiana UUCP: inuxh!stevens