Return Function in C
Level 392 keystrokes
Defines a function that returns the square of an integer.
C code
// Takes an int and returns an int1int square(int n) { // Send n squared back to the caller2 return n * n;3}4 // The returned value 49 is stored in result5int result = square(7);// Print Square: 496printf("Square: %d\n", result);Output
Square: 49
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"× 2,× 1:× 1{× 1}× 1*× 1\× 1