What's better practice between these two pieces of code? Basically, do you want to return values as much as possible, or declare 'more global' variables and have the function change the variable.
Option 1
Option 2Code:int foo = 0; int main() { aFunction(); } void aFunction() { foo = someValue; }
edit: holy macorel! just seconds after posting this, this post appeared on a google search. Google will probably take over the world.Code:int main() { int foo = aFunction(); } int aFunction() { return someValue; }