diff --git a/education/software development/ECE1400/Chapter 11 Exercises.md b/education/software development/ECE1400/Chapter 11 Exercises.md index 977ee81..e032e2a 100644 --- a/education/software development/ECE1400/Chapter 11 Exercises.md +++ b/education/software development/ECE1400/Chapter 11 Exercises.md @@ -9,4 +9,7 @@ ```c middle = (low + high) / 2 ``` -The above statement is illegal because you can't add two pointers together \ No newline at end of file +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. +```c +middle = (int*) (((long) low + (long) high) / 2); +``` \ No newline at end of file