1. A function consists of a group of statements or modules that perform a specific task in a program . The declaration of a function consists of its name, return type and parameters , and definition of a function consists of actual body of a function . There are many built in functions provided by C standard library , If a required function is not built in a library it can be called as User defined function .
Don't use plagiarized sources. Get Your Custom Essay on
(Solved Homework): What is a function? Explain in your own words! Provide the prototype/declaration for a function called comp…
Get an essay WRITTEN FOR YOU, Plagiarism free, and by an EXPERT!
The form of a function can be given as ,
return_type function_name( parameter_list ) {
body of the function
}
In the given definition Return type gives the data type of the returned value from the function , Function name is the name of the function , And parameters hold the values which are passed to a function when it is invoked. The function body consists of all the statements which are required to be executed to perform the task.
2. The Prototype of the function compute_resistance_ohms_law() to calculate the resistance of the conductor is given as :
double compute_resistance_ohms_law (double voltage, double current) {
return voltage / current;
}
The function declaration has the function name as compute_resistance_ohms_law(), It consists of return type as double , It has two input parameters voltage and current in doule precision and the body the function consists of statement return voltage / current ; which calculates the resistance and returns .