Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

void main or int?

Name: Anonymous 2008-04-03 11:50

hey /prog/,
why would you use int main() instead of void main()?

Name: Anonymous 2008-04-03 11:53

Name: Anonymous 2008-04-03 11:59

Void doesn't return anything, right?

Name: Anonymous 2008-04-03 12:02

>>3
correct

Name: Anonymous 2008-04-03 12:08

``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.

9) Thus, int can be replaced by a typedef name defined as int, or the type of argv can be written as char ** argv, and so on.''

Name: Anonymous 2008-04-03 13:18

>>5
Forced indention made this text ugly.                                                                               

Name: Anonymous 2008-04-03 14:59

using void main() = programmer who thought that not having a return type means it's automatically void (it's not.)

Name: Anonymous 2008-04-03 15:04

>>5
Have you read your C-FAQ today?

Name: Anonymous 2008-04-03 15:51

>>5
Is that even relevant to the thread or is that just your way of saying ``I've read the C standard''?

Name: Anonymous 2008-04-03 17:00

>>9
Is that even relevant to the thread or is that just your way of saying ``I've read >>5''?

Name: Anonymous 2008-04-03 18:15

>>10
Is that even relevant to the thread or is that just your way of saying ``I've read >>9''?

Name: Anonymous 2008-04-03 18:16

>>12
Is that even relevant to the thread or is that just your way of saying ``I've written >>12''?

Name: Anonymous 2008-04-03 18:18

>>12
Is that even relevant to the thread or is that just your way of saying ``I've done SICP exercise 1.17''?

Name: Anonymous 2008-04-03 18:35

>>13
Is that even relevant to the thread or is that just your way of saying ``I've done SICP exercise 1.17''?

Name: Anonymous 2008-04-03 19:42

>>14
Is that even relevant to the thread or is that just your way of saying ``I've done SICP exercise 1.17''?

Name: Anonymous 2008-04-04 2:33

Read some fucking K&R.

Name: Anonymous 2009-03-06 12:53

your advice to yourself I use c   to do something   to something A   leader Who may   inspire such a   great president after.

Name: Anonymous 2011-02-04 12:03

Name: Anonymous 2011-02-04 18:26

Name: Anonymous 2011-02-18 12:58

check 'em dubz

Name: Sgt.Kabukiman 2012-05-21 13:49

All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy

Name: Anonymous 2012-05-21 13:53

i use int main because main may return an error code if it doesnt finish succesfully

Don't change these.
Name: Email:
Entire Thread Thread List