🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #229

Re: Can you nest subroutines in C?

#229
From: Dana B Bourgeois
Date: Wed, 28 Jun 1989 05:08
25 lines
1690 bytes
AWRIGHT!!!  Found one I can field....

C doesn't allow nested functions.  All functions are on one 'level'.
But to avoid large amounts of argument passing there are several
techniques like putting all the arguments into a structure and passing
a pointer to it, or making global variables to hold the values before 
you call the next function.  Depends on how structured you want to make
your code.  There are techniques that allow you to have limited globals.
Sorta like having variables in an outer procedure known in an inner one.
C will allow you to create a variable that is known only by the few
functions that you want to know of it and the rest of the functions
remain ignorant of the variable's existance.(hence my term 'limited
globals')

The C gurus have technical terms for all this stuff but if you haven't
been exposed to 'scope' and 'seperate compilation' and 'static external'
then the above explanation will probably make more sense.  My beginning
C course was based around a book called "C by dissection" - A.Kelly &
I. Pohl.  Lots of examples and good explanation.  Stays away from the
more exotic stuff like bit-operators and pointer pointers.  Might be a
good book for you because they go over the storage classes.

Good luck.

Dana
Technical Details
Message-ID: <19945@cup.portal.com>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!portal!cup.portal.com!FelineGrace
References: <4470@crash.cts.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!portal!cup.portal.com!FelineGrace
From: FelineGrace@cup.portal.com (Dana B Bourgeois)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Can you nest subroutines in C?
Message-ID: <19945@cup.portal.com>
Date: 28 Jun 89 05:08:27 GMT
References: <4470@crash.cts.com>
Distribution: na
Organization: The Portal System (TM)
Lines: 25