- Add a ‘{’—The function code starts after the opening curly brace.
- Insert the function code.
To let a function return a value, use the
return statement.
- Add a ‘}’—The function is finished by a closing curly brace.
This program reads a list of integers and returns the sum of even values by
- Implementing a user-defined function
even , which uses the modulus operator % to decide whether a value is even, and
- Using a built-in function
strtok(string,split) , which returns a sequence of integers one by one.
|
|
|