# hw5 - argument and returns a double value. 4. (10 pts)...

This preview shows pages 1–2. Sign up to view the full content.

CS16, W11, UCSB LabHW5: Worth 50% of Lab05 score (50 total points) Print this form, staple loose pages together, and write your answers on it. Accepted: on paper, at the *beginning* of *your* lab section on Thursday, February 10. Place on the front desk as you walk in, before getting seated. No email submission allowed. Name (2 pts): ______________________________________ Umail (2 pts): ______________________@umail.ucsb.edu Lab Section (2 pts) Circle one: 3:30 4:30 5:30 6:30 Read at least the following sections of Etter Chapter 4: sections 4.1, 4.2, 4.4 and 4.8. Then answer the following items. 1. Summarize the meaning of each of the following terms, in your own words. a. (5 pts) Modularity b. (5 pts) Abstraction, in the context of modularity c. (5 pts) Reusability 2. (4 pts) What is the purpose of a function prototype? 3. (5 pts) Write a prototype for a function named process that takes one int

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: argument and returns a double value. 4. (10 pts) Write a whole C function named greatest that takes three int arguments, and returns the greatest of the three values. Remember there is no built-in function max in the C language, but you may write one as a helper function if you want. 5. (5 pts) Write an expression that will set the double variable x to a random value between -2.0 and +2.0, inclusive. double x = _________________________________________________________; 6. (5 pts) The text stresses the importance of surrounding macro parameters in parentheses when the macro uses them in an expression. For instance, here is a macro that multiplies its two parameters: #define MULT(x,y) ((x)*(y)) Explain - including an explicit example - why the parentheses are so important around each of x and y in the expression (x)*(y). End of LabHW5...
View Full Document

## hw5 - argument and returns a double value. 4. (10 pts)...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online