From 9269af0cdd0e6be1c9cc413514d1e751feb3b4a5 Mon Sep 17 00:00:00 2001 From: zleyyij <75810274+zleyyij@users.noreply.github.com> Date: Fri, 25 Oct 2024 14:06:54 -0600 Subject: [PATCH] vault backup: 2024-10-25 14:06:54 --- .../software development/ECE1400/Chapter 11 Exercises.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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