diff --git a/education/software development/ECE1400/Chapter 13 Exercises.md b/education/software development/ECE1400/Chapter 13 Exercises.md index 7590c81..a953771 100644 --- a/education/software development/ECE1400/Chapter 13 Exercises.md +++ b/education/software development/ECE1400/Chapter 13 Exercises.md @@ -38,4 +38,23 @@ scanf("%d%s%d", &i, s, &j); --- -> **7.** Suppose that `str` \ No newline at end of file +> **7.** Suppose that `str` is an array of three characters. Which one of the following statements is not equivalent to the other three? +```c +// A +*str = 0; +// B +str[0] = '\0'; +// C +strcpy(str, ""); +// D +strcat(str, ""); +``` +(d) is different because it effectively does nothing (concatenates `"abc"` with an empty string). The rest of them make `str` effectively empty by setting the first character to a null byte. + +--- + +> **9.** What will be the value of the string `s1` after the following statements have been executed? +```c +strcpy(str, "tire-bouchon"); +strcpy(&str[4], "d-or-wi") +``` \ No newline at end of file