Void Function in C

Level 374 keystrokes

Defines a void function that prints a greeting message.

C code

// void: the function returns no value; char name[] receives a string
1void greet(char name[]) {
// %s is replaced by the string in name
2 printf("Hello, %s!\n", name);
3}
4
// Called as a statement, since there is no result to use: Hello, World!
5greet("World");

Output

Hello, World!
Practice typing this code

Practice typing this code. Results are not recorded in the rankings.

Symbols in this code

The symbols you type in this C code and how often they appear.

  • "× 4
  • (× 3
  • )× 3
  • ,× 2
  • ;× 2
  • !× 1
  • [× 1
  • ]× 1
  • {× 1
  • }× 1

More C examples at level 3

← C typing practice