Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!zaphod.mps.ohio-state.edu!wuarchive!udel!burdvax!ubbpc!wgh From: wgh@ubbpc.UUCP (William G. Hutchison) Newsgroups: comp.lang.c++ Subject: Re: calling main in ANSI C Summary: It used to work anyway! Keywords: main standard Message-ID: <766@ubbpc.UUCP> Date: 4 Dec 90 21:03:52 GMT References: <814@atcmpe.atcmp.nl> <535@taumet.com> Organization: Unisys UNIX Portation Center, Blue Bell, PA Lines: 29 In article <535@taumet.com>, steve@taumet.com (Stephen Clamage) writes: > leo@atcmp.nl (!Leo Willems) writes: > > Yes. In ANSI C, main() may be called from anywhere in the program. > > Steve Clamage, TauMetric Corp, steve@taumet.com Yes: here is an example (K&R C) of echo.c (this will not win an obfuscated C contest, but it certainly is perverse!) #include main(argc, argv) int argc; char *argv[]; { if (argc > 0) { fputs(*argv, stdout); fputs(" ", stdout); return main(--argc, ++argv); } puts(""); return 0; } -- Bill Hutchison, DP Consultant rutgers!cbmvax!burdvax!ubbpc!wgh (work) Unisys UNIX Portation Center uunet!eidolon!wgh (home) P.O. Box 500, M.S. B121 "At the moment I feel more like arguing than Blue Bell, PA 19424 being good" Raymond Smullyan _The Tao is Silent_ Brought to you by Super Global Mega Corp .com