As these things happen, I have some updates and notes for the book. This is nothing radical, but if you want to keep current with an evolving language like C, these tech tidbits are important to know.
Properly Declaring the main() FunctionIn the book, I use the following to declare main(): int main() This is fine and okay by all standards. But it's better to do this when your program isn't using any of main()'s arguments: int main(void) This appears to be all the rage now, and I'm coding all my new projects that way. Should the book be updated, I will reflect the declaration above in the new edition. But do keep in mind that the old way is still okay, just old. The Better Way to returnIn the book I use the following format for the return keyword: return(0); This is fine and there is no problem with that, other than return really isn't a function. In fact, most modern coders refer to the above format as "old school." Here is the way the beautiful people are writing return these days: return 0; No parentheses, just return followed by a space, the value to return, then the semicolon. SummaryMaking these changes, both to main() and return, will not affect the way your program runs one iota. But doing so will ensure that your code is up-to-date with the current C language standard, and make your stuff less likely to laughed at by C programming snobs. |

Copyright © 2006 by Quantum Particle Bottling Co.
All rights reserved