Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!gatech!uflorida!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: want to know Message-ID: <10708@smoke.BRL.MIL> Date: 11 Aug 89 20:53:13 GMT References: <8487@bsu-cs.bsu.edu> <2980@solo9.cs.vu.nl> <182@sunquest.UUCP> <664@laic.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 16 In article <664@laic.UUCP> darin@nova.UUCP (Darin Johnson) writes: -In article <2980@solo9.cs.vu.nl>, roemer@cs.vu.nl (Roemer Lievaart) writes: -> I'm also a University's student in need of help. I always see that people -> define the function 'main' in C-programs. Why is that? What should it return? -> Can't I use another name? -It is a UNIX-ism. The UNIX linker uses that function name as the name of -the first routine to jump to (although many UNIX version may have ways -around this). Other operating systems and linkers do things differently -(first function found, special symbol in the object file, specified on -command line, etc.). However, most C compilers use main() as the -default (with a way out if you need to), since that is what K&R uses. The special role of main() is NOT a "UNIXism". It is REQUIRED BEHAVIOR in ANY standard-conforming hosted implementation of C. Standalone use of C can indeed have other startup rules.