Great job learning about functions! We’ve managed to cover many important topics like:
- Functions are a named set of instructions
- Functions can take in a set of inputs and produce some output
- Functions help you write DRY (Don’t Repeat Yourself) code
- C comes with many libraries that contain useful, ready-to-use functions
- Function calls can take arguments and return values
- Functions are made up of a function signature and body.
voidcan be used as a return or parameter type
- A function returns a value with a
returnstatement in the body
- A function can have parameters that are placeholder variables for the function
- Pointers can be used as function parameters to help with memory management
- Function prototypes are good practice in C
With the help of functions, you can now build larger, cleaner projects.
Try to refactor the code in the
main() function from the beginning of the lesson with all the knowledge you now have.
You can also use the space to play around and explore your knowledge of functions. Have fun!