Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Feb 1998 04:49:05 -0500
From:      MALCOLM BOFF <Malcolm_Boff@compuserve.com>
To:        freebsd-questions <freebsd-questions@FreeBSD.ORG>
Cc:        Doug <dwhite@gdi.uoregon.edu>
Subject:   RE: Can't getopt()
Message-ID:  <199802060449_MC2-3226-6A90@compuserve.com>

next in thread | raw e-mail | index | archive | help
This is a MIME-encapsulated message

--07522c83-9ed2-11d1-b22e-00805feabca1
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Malcolm G. Boff
Sylmex Ltd.

--07522c83-9ed2-11d1-b22e-00805feabca1
Content-Type: text/plain; charset=ISO-8859-1; name="doug.txt"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="doug.txt"

=0D
=0D
On Tue, 3 Feb 1998, Doug White wrote:=0D
=0D
>> The program below should print the first command line argument but whe=
n=0D
>> I try to compile it I get the errors 'argc' undeclared and 'argv'=0D
>> undeclared. =0D
>=0D
>Forget your C text? :)=0D
>=0D
>> main()=0D
>=0D
>The proper declaration should be =0D
>=0D
>void=0D
>main(int argc, char** argv)=0D
>=0D
>argc is the number of arguments, argv is the string of arguments.=0D
>=0D
>change void to int and return(0) at the end if you want to be all proper=
=0D
>UNIXlike.=0D
=0D
My only comment to this would be that if you really want to be both=0D
'C' like and 'UN*X' like then DON'T use 'return(0)' in 'main' function=0D=

use 'exit(0)' which does considerably more than 'return' which is simply=0D=

a stack popper.=0D

--07522c83-9ed2-11d1-b22e-00805feabca1--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199802060449_MC2-3226-6A90>