Overloading vs. Default Args
void error(char *message)
fprintf(stderr, “You have one message waiting. It is:\n”);
fprintf(stderr, “%s\n”, message);
void error(char *message, int copies)
fprintf(stderr, “Copy %d: %s\n”, copies, 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);
Note that the same error function is used for both messages in the default arg example; different functions are used here.