Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site moncol.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!vax135!petsd!moncol!john From: john@moncol.UUCP (John Ruschmeyer) Newsgroups: net.lang.c Subject: Re: C question Message-ID: <259@moncol.UUCP> Date: Thu, 18-Apr-85 09:52:21 EST Article-I.D.: moncol.259 Posted: Thu Apr 18 09:52:21 1985 Date-Received: Fri, 19-Apr-85 00:36:06 EST References: <1617@ut-ngp.UUCP> Organization: Monmouth College, West Long Branch, NJ 07764 Lines: 54 >From: kjm@ut-ngp.UUCP (Ken Montgomery) >Message-ID: <1617@ut-ngp.UUCP> > >From: lspirkov@udenva.UUCP (Goldilocks) >>In article <> jack@boring.UUCP (Jack Jansen) writes: >>> >>>procedure p(var i:integer):integer; > ^^^ >>>begin >>> p := i; >>> i := i+1; >>>end (* p *); >>> >> >>you obviously don't know your pascal! a function returns >>something. a procedure doesn't. >> >> Goldi > >The 'var' keyword has the effect that the value of 'i' is assigned >to the corresponding actual parameter in the calling routine at the >termination of the called routine. What goldi was referring to was this: >procedure p(var i:integer):integer; ^^^^^^^^ The part I have highlighted is used in a FUNCTION declaration to declare the type of the value returned. The type of values returned by a PROCEDURE is declared by the 'var' as you pointed out. The correct declaration is: procedure p(var i:integer); I don't have the original article handy, but it almost looks like someone was trying to perform the illegal: function p(var i:integer):integer; which would be an attempt at declaring a function which returns two values. I pray that somewhere there isn't a compiler which would accept that. (Ooh, ick!) -- Name: John Ruschmeyer US Mail: Monmouth College, W. Long Branch, NJ 07764 Phone: (201) 222-6600 x366 UUCP: ...!vax135!petsd!moncol!john ...!princeton!moncol!john ...!pesnta!moncol!john Silly Quote: "Ah, but what is a dream but reality without a backbone?"