Clever.

Status
Not open for further replies.

JaoMao1

Member
foxtrotc0nx.gif



Lol :P
 
BEST COMIC EVER

I use void too. It's too much of a pain to write out "char* args[]" unless I actually have a use for parameters.
 
Yes, well, you understand memory things (that's what the asterisk is for, correct?). I don't. Hence I leave it blank and stuff.

For console window-based programs, that works just fine, and OpenGL doesn't even LIKE using that in a program, so...
 
Man, that comic is old. Make sure you guys get the patch to bring it up to version 1.0.1.

There are two legal ways to define the main() function in C:

int main(void) - ignoring command-line arguments
int main(int argc, char *argv[]) - argc is number of command line arguments (counting the program name, which is argv[0]), argv is an array of the arguments themselves

The default return value is int, so these are identical:

int main(void)
main(void)

The default parameter list is void, so these are identical:

int main(void)
int main()
main()

I prefer to write (void) instead of () because although they're identical in a function definition, in a function declaration, () means something different. In particular,

int dosomestuff();

and

int dosomestuff(void);

might seem to be identical, but the first one actually tells the compiler not to check the parameters. That is, if you later call

dosomestuff(i, j, "!@#");

it won't be able to diagnose that you gave the function three arguments it doesn't need. With the second declaration of dosomestuff, it can tell you exactly where you messed up.
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top