[Courses] Absolute Beginning C: void?

techno curmudgeon technocurmudgeon at gmail.com
Mon Feb 6 04:48:58 UTC 2012


In looking around (extracurricular reading?  I never even did that in
university!) a lot of the 'hello world' examples start with 'void' in
front of main().

Researching "void" almost always says words to the effect "is the type
for a function does not return a value"...OK, got that.

Then they launch into wildly gobbledegooky jargon about other uses.
Including "A C prototype taking no arguments, e.g. void f() above, has
been deprecated however in C99" (from a footnote in
http://en.wikipedia.org/wiki/Void_type).

I don't want to get too off track here.  Since hello world worked, a
void keyword is not required (right?).  And since it didn't generate a
warning, it's not even bad form not to have one, right?

I guess that's my question.  While not needed, is it good practice to
use the 'void' keyword?

Thanks!


More information about the Courses mailing list