diff --git a/notes/.cpp.php.kate-swp b/notes/.cpp.php.kate-swp deleted file mode 100644 index 11b7d00..0000000 Binary files a/notes/.cpp.php.kate-swp and /dev/null differ diff --git a/notes/cpp.php b/notes/cpp.php index 3245371..0e6d9ee 100644 --- a/notes/cpp.php +++ b/notes/cpp.php @@ -343,7 +343,31 @@
A function is a wrapper to easily reuse code and improve readability of your program. The function signature contains the return type, the identifier of the function, and the parameters that the function requires. The function contains statements within the curly braces. Finally, the function returns a value which has a type indicated in the function signature. Proper functions also have one intended use. If a function contains more than one use, it is a good idea to split them up.
- Functions must be defined before they are called. That is, the definition must come before any reference to using the function. A function call is done by referencing the name of the function as a statement. For example type name (parameters) {...}my_function(1,2,3); is a call to my_function(int a, int b, int c) {...} with the parameter values a = 1, b = 2, c = 3.
+ Functions must be defined before they are called. That is, the definition must come before any reference to using the function. A function call is done by referencing the name of the function as a statement. For example my_function(1,2,3); is a call to my_function(int a, int b, int c) {...} with the parameter values a = 1, b = 2, c = 3.
+
+ A function which does not return anything has the type of void. When using a void type for a function, it is okay to omit the return statement at the end of the function. In other words, when using a void type, the return statement is optional.
+
+ Functions are also essential to organized code. It can also save you time because you no longer need to rewrite or copy large blocks of code that may need to be re-used. Instead, just call the function.
+
+ In c++, there are three different types of function parameters. +