Subroutine layout in C

Frank I. Reiter frank at rsoft.UUCP
Fri Dec 23 03:37:11 AEST 1988


In article <2800002 at uxg.cso.uiuc.edu> phil at uxg.cso.uiuc.edu writes:
>
> I want S to be known outside.
>I also want to have two subroutines X and Y to be known ONLY to S (not known
>outside of S).  Either can be called by S, and each calls the other in a
>recursive way.  I also need to share several variables entirely within
>this context (shared between S, X, Y).  They can be static.

Put S(), X(), and Y() in their own file.  Declare X() and Y() to be static
and do the same with any global variables to be accessed only by S(), X(),
and Y().

Other modules will be able to call S() but not X() or Y() or any of the static
variables.

-- 
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
Frank I. Reiter             \ /    UUCP:    {uunet,ubc-cs}!van-bc!rsoft!frank
Langley, British Columbia   / \     BBS:    Mind Link @ (604)533-2312
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*



More information about the Comp.lang.c mailing list