Simple Function in C
Level 363 keystrokes
Defines a function that returns the square of a number and calls it.
C code
// Return type int, name square, one int parameter n1int square(int n) { // return ends the function and hands n * n back to the caller2 return n * n;3}4 // square(5) is evaluated first and returns 25, which printf prints5printf("%d\n", square(5));Output
25
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;× 2"× 2,× 1{× 1}× 1*× 1\× 1%× 1