Wow! Check out all you’ve learned about C++ functions:
- A function is a named group of statements that do something together.
- Functions allow you to create more flexible, modular, and DRY code.
- C++ has many built-in functions that you can use.
- Functions are called like
- A function has a declaration with a return type and possible parameters.
- A function has a definition (or body) with a group of statements and a possible return value.
voidfunctions do not have return values.
- Functions with a return value have return statements.
- Parameters are variables used as placeholders for function input values.
- Arguments are a function’s actual input values.
You now know enough C++ to create some pretty cool projects on your own. But, as you’ll see, there are still many ways to improve your code.
Try using functions to rewrite (or refactor) that IT conversation program we showed you.
You can also use this space to play around with building your own functions. Have fun!
Take this course for free