What is Function?
Function is a feature or tool used to wrap one or several computational processes and supporting information, to complete an action or process of computing based on its usefulness.
From the definition above, it can be concluded that the function is a special tool that can take action to solve specific problems. The point? The intent of the sentence can be understood from the use of the function. Still confused? Here the example of a function that must have been frequently used in writing programs in C language, printf (), getchar (), scanf () is a function that we can use to solve or handle a process, and each of these functions has a way of working :)
Declaration and Usage
A function declared as below
return_type function_name (parameter_declaration, [second_parameter_if_any)
{
declarations_variable;
statements;
}
return_type is the data type of a function declared. This data type is the main thing that must be considered in making a function or a function, Okay, then how to use the functions that we make? In general, if we want to use a function that we have previously made, we simply call the name of the function and the function will only work by itself. So we do not have to worry about how the function that implement what we are told, because the C language already has its own way to handle it, which is important for us is how to make a function properly.
Note the declaration and use of function in the program code above. Authors declare two functions with different return type to be used in the program, for a declaration written before function main ().
Then, consider the declaration of a function is different . The main difference in the type of data and functions that define the parameters of the function.
At the time of declaring the function, the variable naming parameter is not an important part, the most important is the data type of the parameter. Okay, code for the function that has been declared previously in the lower part (after the function main ()). Naming the variable parameters to be used.
Function is a feature or tool used to wrap one or several computational processes and supporting information, to complete an action or process of computing based on its usefulness.
From the definition above, it can be concluded that the function is a special tool that can take action to solve specific problems. The point? The intent of the sentence can be understood from the use of the function. Still confused? Here the example of a function that must have been frequently used in writing programs in C language, printf (), getchar (), scanf () is a function that we can use to solve or handle a process, and each of these functions has a way of working :)
Declaration and Usage
A function declared as below
return_type function_name (parameter_declaration, [second_parameter_if_any)
{
declarations_variable;
statements;
}
return_type is the data type of a function declared. This data type is the main thing that must be considered in making a function or a function, Okay, then how to use the functions that we make? In general, if we want to use a function that we have previously made, we simply call the name of the function and the function will only work by itself. So we do not have to worry about how the function that implement what we are told, because the C language already has its own way to handle it, which is important for us is how to make a function properly.
Note the declaration and use of function in the program code above. Authors declare two functions with different return type to be used in the program, for a declaration written before function main ().
Then, consider the declaration of a function is different . The main difference in the type of data and functions that define the parameters of the function.
At the time of declaring the function, the variable naming parameter is not an important part, the most important is the data type of the parameter. Okay, code for the function that has been declared previously in the lower part (after the function main ()). Naming the variable parameters to be used.