Default Arguments
void error(char *message, int copies = 1)
fprintf(stderr, “%s\n”, message);
// print this message once
error(“mass of the universe exceeded maximum allowed value”);
// print 1,000 copies of this message (very annoying)
error(“energizer bunny keeps going and going…”, 1000);
- Any number of default arguments can be used
- Don’t confuse this with overloaded functions!