vault backup: 2024-10-12 20:52:02
This commit is contained in:
parent
84bf3689e5
commit
bee5599cc3
@ -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
|
Loading…
Reference in New Issue
Block a user