home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ogicse!lclark!harrison
- From: harrison@lclark.edu (Mark Harrison)
- Newsgroups: comp.lang.c
- Subject: Re: main()
- Message-ID: <1992Sep2.162015.11561@lclark.edu>
- Date: 2 Sep 92 16:20:15 GMT
- Article-I.D.: lclark.1992Sep2.162015.11561
- References: <cee1.715416182@Isis.MsState.Edu>
- Organization: Lewis & Clark College, Portland OR
- Lines: 34
-
- In article <cee1.715416182@Isis.MsState.Edu> cee1@ra.msstate.edu (Charles Evans) writes:
- >Ok, I thought supposadly in ANSI C/C++ one was to declare main() as such:
- >either:
- >
- >int main(void)
- > or
- >void main(void)
- >
- >BC++ books say int main(void) but what is the benefit of 'return 0' at the
- >end.. seems like wasted space.
- >
- >Now in VERY new C++ books or VERY new C books, they usually have either
- >
- >int main()
- >or void main()
- >
- >so what is wrong with 'main()' .. ANSI i suppose
- >
- >so what should i use
- >
- >void main(void) looks best (to me)?
- >
- >any htoughts?
-
- In my programs, I use 'void main()' and never had any problems doing so.
- These are written with Turbo C/C++ 3.0, so I don't know about any others,
- but it sounds like you are using BC, so there shouldn't be any difference.
- If you just use 'main()' the compiler will assume that it is an int function.
-
- --
- =============================================================================
- Mark Harrison | "We are the Priests, of the Temples of Syrinx
- harrison@sun.lclark.edu | Our great computers fill the hallowed halls."
- -- Me | -- Rush
-