home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / c / 13118 < prev    next >
Encoding:
Internet Message Format  |  1992-09-02  |  1.5 KB

  1. Path: sparky!uunet!ogicse!lclark!harrison
  2. From: harrison@lclark.edu (Mark Harrison)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: main()
  5. Message-ID: <1992Sep2.162015.11561@lclark.edu>
  6. Date: 2 Sep 92 16:20:15 GMT
  7. Article-I.D.: lclark.1992Sep2.162015.11561
  8. References: <cee1.715416182@Isis.MsState.Edu>
  9. Organization: Lewis & Clark College, Portland OR
  10. Lines: 34
  11.  
  12. In article <cee1.715416182@Isis.MsState.Edu> cee1@ra.msstate.edu (Charles Evans) writes:
  13. >Ok, I thought supposadly in ANSI C/C++ one was to declare main() as such:
  14. >either:
  15. >
  16. >int main(void)
  17. > or
  18. >void main(void)
  19. >
  20. >BC++ books say int main(void) but what is the benefit of 'return 0' at the
  21. >end.. seems like wasted space.
  22. >
  23. >Now in VERY new C++ books or VERY new C books, they usually have either
  24. >
  25. >int main()
  26. >or void main()
  27. >
  28. >so what is wrong with 'main()' .. ANSI i suppose
  29. >
  30. >so what should i use
  31. >
  32. >void main(void) looks best (to me)?
  33. >
  34. >any htoughts?
  35.  
  36. In my programs, I use 'void main()' and never had any problems doing so. 
  37. These are written with Turbo C/C++ 3.0, so I don't know about any others,
  38. but it sounds like you are using BC, so there shouldn't be any difference.
  39. If you just use 'main()' the compiler will assume that it is an int function.
  40.  
  41. -- 
  42. =============================================================================
  43. Mark Harrison           |  "We are the Priests, of the Temples of Syrinx
  44. harrison@sun.lclark.edu |   Our great computers fill the hallowed halls."
  45.               -- Me     |                                    -- Rush
  46.