Appearance
User-defined Function
Defining Function
Syntax
cmd
return_type function_name(parameters) {
// Function body
// Perform actions
return something;
}- return_type: The data type of the value the function will return (e.g., int, float, void for no return).
- function_name: The name of the function.
- parameters: The input variables or arguments passed to the function (optional).
Calling Function
Syntax
cmd
function_name(arguments);- function_name: The name of the function to be called.
- arguments: The input values or variables passed to the function if it requires any parameters (optional).