update functions.md

This commit is contained in:
2026-03-02 14:48:38 -06:00
parent 91628c023e
commit b0dc2399c7

View File

@@ -43,4 +43,4 @@ Suppose you want a function to occassionaly not have values for parameters expli
void average(float num1 = 3, float num2 = 3, float num3 = 3); void average(float num1 = 3, float num2 = 3, float num3 = 3);
``` ```
In this example, the default parameters were create in the function prototype. Suppose you call the function by `average();`, then without passing and values, num1, num2, and num3 were all initialized with 3 as we have define in the prototype. Default arguments also work with just one parameter. You can set whatever parameter you want to have a default argument. Also, as long as the default argument is defined in the prototype, you should not include it in the definition. In this example, the default parameters were create in the function prototype. Suppose you call the function by `average();`, then without passing and values, num1, num2, and num3 were all initialized with 3 as we have define in the prototype. Default arguments also work with just one parameter. You can set whatever parameter you want to have a default argument. Also, as long as the default argument is defined in the prototype, you should not include it in the definition. __Keep in mind, default arguments must be at the end of the parameter list.__