diff --git a/education/software development/ECE1400/Chapter 9 Exercises.md b/education/software development/ECE1400/Chapter 9 Exercises.md index 74bec6e..cb7e302 100644 --- a/education/software development/ECE1400/Chapter 9 Exercises.md +++ b/education/software development/ECE1400/Chapter 9 Exercises.md @@ -38,3 +38,12 @@ int check(int x, int y, int n) { > 7. Suppose that function `f` has the following definition: > `int f(int a, int b) { ... }` > Which of the following statements are legal? Assume that `i` has type `int` and `x` has type `double`). + +Answer: +All of them are legal and will compile and run. (c) and (d) are what I would consider bad practice because they perform an implicit conversion from a double to an int, and should include an explicit cast. + +> 8. Which of the following would be valid prototypes for a function that returns nothing and has one double parameter? + +Answer: +(a) and (b). +Parameters must contain a type annotation but theyd o \ No newline at end of file