quote:
Originally posted by The_Muffin_Man/B0b:
One thing I never really questioned (I swear!), but thought it might be good to ask is: are using Global Variables OK if you are using the variable in practically every function?
Global variables are "cheating". That's why I make liberal use of them.
But actually you should try not to use them and if you are a developer in a software company your code just may not pass code inspection if you have global variables. And you may just be assigned to create specific modules, in which case you wouldn't be at liberty to use global variables. And your code will be more modular if you use local variables (the code in your functions/modules can be used in other programs and not be dependant on global variable names). Especially important if you want to make a "library" of functions.
quote:
Also, what's with return 0;? I've never used it and never had a problem.
I could be wrong but I think the compiler will add the equivelant of a "return 0" on all functions including main if you do not specify it. I may be talking out of my arse on this one though. Let me know if you find out differently.
[ October 31, 2002: Message edited by: void main ]