diff --git a/education/software development/ECE1400/Chapter 11 Exercises.md b/education/software development/ECE1400/Chapter 11 Exercises.md index e032e2a..f81b663 100644 --- a/education/software development/ECE1400/Chapter 11 Exercises.md +++ b/education/software development/ECE1400/Chapter 11 Exercises.md @@ -9,7 +9,12 @@ ```c middle = (low + high) / 2 ``` -The above statement is illegal because you can't add an `int *` to an `int *`. It can be made legal by casting `low` and `high` to numbers, performing the operation, then casting to a pointer. +The above statement is illegal because you can't add an `int *` to an `int *`. The below operation is legal because you can perform pointer subtraction, and because `low` is defined on the left hand side of the equation, then adding a long to a pointer is valid. ```c -middle = (int*) (((long) low + (long) high) / 2); +middle = low + (high - low) / 2; +``` + +3. What will be the contents of the `a` array after the following statements are executed? +```c +{1} ``` \ No newline at end of file