Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Feb 1998 13:10:52 -0800 (PST)
From:      Doug White <dwhite@gdi.uoregon.edu>
To:        Geoffrey Robinson <grobin@accessv.com>
Cc:        questions@FreeBSD.ORG
Subject:   Re: Can't getopt().
Message-ID:  <Pine.BSF.3.96.980203130336.13454H-100000@gdi.uoregon.edu>
In-Reply-To: <34D6150D.2FD35180@accessv.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 2 Feb 1998, Geoffrey Robinson wrote:

> The program below should print the first command line argument but when
> I try to compile it I get the errors 'argc' undeclared and 'argv'
> undeclared. 

Forget your C text? :)

> main()

The proper declaration should be 

void
main(int argc, char** argv)

argc is the number of arguments, argv is the string of arguments.

change void to int and return(0) at the end if you want to be all proper
UNIXlike.

Doug White                              | University of Oregon  
Internet:  dwhite@resnet.uoregon.edu    | Residence Networking Assistant
http://gladstone.uoregon.edu/~dwhite    | Computer Science Major





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.980203130336.13454H-100000>