delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/25/01:16:26

Date: Fri, 24 Oct 1997 22:13:18 -0700 (PDT)
Message-Id: <199710250513.WAA07733@adit.ap.net>
Mime-Version: 1.0
To: hwstock AT swcp DOT com, djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: Reading the command line

At 02:08  10/24/1997 -0600, H.W. Stockman wrote:
>Jon Seanor wrote:
>> 
>> Just a quick question.
>> 
>> I'm forever forgetting the syntax for reading the command line, i.e. passing
>> it to the main function as parameters.  Do you know what the syntax is?
>> 
>> void main(char* argv[], int argc)        <---is this right?
>> {}
>
>order reversed -- argc first.  That should be in just
>about any C book...
And it is `int main', NOT `void main'. `main' MUST ALWAYS return `int'. This
is the correct declaration:

int main(int argc, char *argv[])
{}

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019