Mail Archives: djgpp/1996/12/20/02:37:51
Benjamin D Chambers wrote:
> >My program is:
> >#include <stdio.h>
> >main()
> >{
> > printf("whatever");
> >}
> >
> Not to be nit-picky (okay, I'm nit-picking) but I believe there are only
> two ANSI defined ways to declare main. The one you probably wanted to
> use was
> int main(void)
> {
> ...your commands...
> return(0); ...Or whatever...
> }
Actually, the mere declaration
main() { ... }
in fact does define main as returning int and taking no parameters. In C,
the default return type of a function when not explicitly specified is int.
Also, when no parameters are explicitly specified, in a definition it is
taken as of taking no parameters. (In a prototype, in C, it doesn't say
anything about the parameter list; in C++, it always means no parameters.)
--
Erik Max Francis | max AT alcyone DOT com
Alcyone Systems | http://www.alcyone.com/max/
San Jose, California | 37 20 07 N 121 53 38 W
&tSftDotIotE | R^4: the 4th R is respect
"You must surely know if man made heaven | Then man made hell"
- Raw text -