want to know

Darin Johnson darin at nova.laic.uucp
Fri Aug 11 09:32:58 AEST 1989


In article <2980 at solo9.cs.vu.nl>, roemer at cs.vu.nl (Roemer Lievaart) writes:
> 
> Hi, everybody,
> 
> 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.

Also, for you confusion, most UNIX kernels do not start at main() or even
have a main()...

Darin Johnson (leadsv!laic!darin at pyramid.pyramid.com)
	We now return you to your regularly scheduled program.



More information about the Comp.lang.c mailing list