From 75f65b24bb4b085dd4487408fa1cda1463cc8913 Mon Sep 17 00:00:00 2001 From: zleyyij <75810274+zleyyij@users.noreply.github.com> Date: Tue, 8 Oct 2024 21:05:01 -0600 Subject: [PATCH] vault backup: 2024-10-08 21:05:01 --- .../software development/ECE1400/Chapter 8 Exercises.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/education/software development/ECE1400/Chapter 8 Exercises.md b/education/software development/ECE1400/Chapter 8 Exercises.md index c72d8e0..d5b88eb 100644 --- a/education/software development/ECE1400/Chapter 8 Exercises.md +++ b/education/software development/ECE1400/Chapter 8 Exercises.md @@ -1,8 +1,11 @@ > 1. We discussed using the expression `sizeof(a) / sizeof(a[0]` to calculate the number of elements in an array. The expression `sizeof(a) / sizeof(t)` where `t` is the type of `a`'s elements would also work, but it's considered an inferior technique. Why? +Answer: +Using the type of the array's first element means that if you change the type of an array, it won't break the code that calculates the number of elements. + > 3. Write a declaration of an array named weekend containing seven `bool` values. Include an initialize that makes the first and last values `true`; all other values should be `false`. -> 6. Calculators, watches, and other electronic devices often rely on 7 segment displays for numerical output. To form a digit, such devices turn on some of the seven segments while leaving others off. +> 4. Calculators, watches, and other electronic devices often rely on 7 segment displays for numerical output. To form a digit, such devices turn on some of the seven segments while leaving others off. > > Here's what the array might look like, with each row representing one digit: ```