🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: csu.cs.200
Article #364

Re: Basic C++ question

#364
From: Corby S. Hudnall
Date: Tue, 03 Feb 1998 00:00
61 lines
1741 bytes
You should have your function prototypes up at the top i.e. (note that
these are global prototypes so they can be called from anywhere by
anyone)

void function1();
void function2();
void function3();

> 
> 
> void main()
> {
>         //Declare function prototypes
>         void function1();
> 
> return;
> } //end main

With prototypes at the beginning, you can put the bodies of your
accessory function anywhere you want, including different files to break
up your program.

> 
> void function1()
> {
>         //Declare function prototypes
>         void function2();
>         void function3();
> 
> return;
> } //end function1
> 
> void function2()
> {
> return;
> } //end function2
> 
> void function3()
> {
> function2();
> return;
> } //end function3
> 
> Okay, now here's the question:
> 
> Is it okay for me to call function2 within function3?

Again, because the prototypes are declared globally with the above
modifications, functions3 can call any of the prototypes functions that
it wants to.

> 
> Thanks in advance . . .
> Trey


cheers
--
Corby S. Hudnall
http://www.cs.colostate.edu/~hudnall/cs200
Technical Details
Message-ID: <34D75220.A194E74B@cs.colostate.edu>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <34D61302.2F577ADA@lamar.colostate.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 127144,f08d1a1544bcc5dc
X-Google-Attributes: gid127144,public
From: "Corby S. Hudnall" <hudnall@cs.colostate.edu>
Subject: Re: Basic C++ question
Date: 1998/02/03
Message-ID: <34D75220.A194E74B@cs.colostate.edu>
X-Deja-AN: 321719791
Content-Transfer-Encoding: 7bit
References: <34D61302.2F577ADA@lamar.colostate.edu>
Mime-Version: 1.0
To: Trey Herschede <treyh@lamar.colostate.edu>
Content-Type: text/plain; charset=us-ascii
Organization: Colorado State University
Newsgroups: csu.cs.200