Date: Tue, 28 Oct 1997 11:15:55 -0500 (EST) From: "Art S. Kagel" Reply-To: kagel AT ns1 DOT bloomberg DOT com To: Jon Seanor Cc: djgpp AT delorie DOT com Subject: Re: Reading the command line In-Reply-To: <62q0ic$73f$1@panther.rmplc.co.uk> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Fri, 24 Oct 1997, Jon Seanor wrote: > >And the return type of main is int, not void. That should be in any text > >book too. > > > Only if you want to return something! WRONG! WRONG! WRONG! WRONG! WRONG! WRONG! WRONG! WRONG! WRONG! WRONG! Function main() MUST ALWAYS RETURN INT and MUST ALWAYS END WITH A RETURN statement! The startup code will be returning the value at the top of the stack whether you like it or not, this is required by C convention, the C standard, and most modern operating systems. If you do not want to return anything useful return zero(0), but you must return something or the OS status code (ERRORLEVEL in DOS) for the task will be garbage. Check the news archives for the specific references to K&R and the C standard. Art S. Kagel, kagel AT bloomberg DOT com