/* * Assignment * Chapter 8 * By: John Stile */ 1. What are each of the following and what information do they convey? Code: // Answer: a) float ccc(int xx, float yy) // header for function ccc: takes an int (assigns to xx), and a float (assigns to yy) b) int xxx(void); // prototype for function xxx: takes nothing, returns an int c) void mmm( char, char, float, int; // prototype for function mmm, takes 2 chars, float and int, and returns nothing 2. Which of the three fucntions in question 1 have return lines in their code bodies? Answer: a and b 3. Correct the following that employs the same functions: main int main(void) { { float AA float AA; float BB = 9.43; float BB = 9.43; float CC = 4.543; float CC = 4.543; int DD = 5; int DD = 5; char EE = 'b'; char EE = 'b'; AA = ccc(BB); AA = ccc(DD,BB); BB = xxx(DD); BB = (float)xxx(); CC = mmm(AA,BB,CC); mmm(EE,EE,AA,DD); printf("Values are: %d, %d, %d \n", AA, BB, CC); printf("Values are: %d, %d \n", AA, BB); } 4. A variable bbb is declared before main as an int with value of 5. A variable bbb is declared in main as a float with value of 2.345. A function does not declare a variable bbb but performs a calculation and store it's result 7 in bbb. In main a printf statemnt outputs the value of bbb. What value is output and why? Answer: The output is 7.000000. Local declaration trumps global. Since funciton is called after the float declaration and assignment it reassigns the value, but the variable remains a float. 5. Create a new functions source file and header file containing neened informatino for your user functions, and add two functions. Write a program that employs the user functions in the new file.