Function with Multiple Parameters in C
Level 393 keystrokes
Defines a function with two parameters that returns their sum.
C code
// Two parameters, separated by commas, each with its own type1int add(int a, int b) { // Return the sum to the caller2 return a + b;3}4 // Arguments are matched by position: a = 3, b = 45int result = add(3, 4);// Print Sum: 76printf("Sum: %d\n", result);Output
Sum: 7
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.
,× 3;× 3(× 3)× 3"× 2:× 1{× 1}× 1\× 1%× 1