C/C++ Arena

Step 3 of 7

void functions

A function that doesn't return a value has return type void. It's used for its effect, like printing.

void banner(void) {
    printf("=== ROUND START ===\n");
}

((void) in the parameter list means "takes no arguments".)

Your turn: write void print_bar(int n) that prints n = characters followed by a newline. print_bar(5) prints =====.

Previous: Write a function Next: Prototypes