Advice for Functions

Should I keep the number of arguments in a function to a certain number? Any recommendations?

I have a function that writes stats to a dat file for a baseball sim, right now that function takes 10 arguments and I'm considering adding 10 more (for the home team's stats). Or should I keep them separate in that have a function that writes visitor stats then one for home stats. Both sets go to different dat files.

Is there a better approach rather than just lining up a series of arguments in one function to only have it write and print the results. This function is void, so no returned value. Any Thoughts or advice.
Most likely all the arguments you are sending are related in some way, so they should belong to a class, then you can just send one or two objects.
Either that or arrays/vectors/etc.
As a rule of thumb, if you're passing more than around 7 parameters, you're doing something wrong.
Topic archived. No new replies allowed.