Path: 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 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