ET2560 Introduction to C Programming Chapter 3
What is a formal parameter?
A formal parameter is used in a function definition to represent a corresponding actual argument.
What is the purpose of a function argument?
A function argument is used to pass information into a function.
Explain how a structure chart differs from an algorithm.
A structure chart shows the subordinate relationships between sub problems; an algorithm lists the sequence in which sub problem solutions are carried out.
Developing a program from its documentation means that every statement in the program has a comment. True or false?
False
Each function is executed in the order in which it is defined in the source file. True or false?
False
The principle of code reuse states that every function in your program must be used more than once. True or false?
False
What does the following function do? void nonsense(void) { printf("*****\n"); printf("* *\n"); printf("*****\n"); }
It displays a rectangle of asterisks.
What does the following main function do? int main(void) { nonsense(); nonsense(); nonsense(); return (0); }
It displays three rectangles of asterisks on top of each other.
How is a function in a C program executed?
It is called into execution by a function call, that is, the function name fol- lowed by its arguments in parentheses.
If an actual argument of −35.7 is passed to a type int formal parameter, what will happen? If an actual argument of 17 is passed to a type double formal parameter, what will happen?
The formal parameter's value will be −35. The formal parameter's value will be 17.0.
Write this equation as a C statement using functions exp, log, and pow: y = (enlnb)2
y = pow(exp(n * log(b)), 2);