int 0x80



gorlist@int0x80:~$ cat news.txt

int main(void)
Quoting the c99 standard:
5.1.2.2.1 Program startup
1 The function called at program startup is named main. The implementation declares no
prototype for this function. It shall be defined with a return type of int and with no
parameters:
int main(void) { /* ... */ }
or with two parameters (referred to here as argc and argv, though any names may be
used, as they are local to the function in which they are declared):
int main(int argc, char *argv[]) { /* ... */ }
or equivalent;9) or in some other implementation-defined manner.

So in C, int main(void) is the only acceptable way of declaring main() in case that it takes no arguments.
In C++, int main() is the equivalent of C's int main(void).

int main() is different from int main(void).
int main() means that it takes an unknown number of arguments, as opposed to int main(void) which means that it takes no arguments.

More here:
http://www.research.att.com/~bs/bs_faq2.html#void-main
http://users.aber.ac.uk/auj/voidmain.shtml
0 Comments
Posted on 15 Dec 2007 by gorlist


Comments
name:
email: * (will not be published)
website:
comment:
Linux creator's first name