vault backup: 2024-11-03 14:30:04

This commit is contained in:
zleyyij 2024-11-03 14:30:04 -07:00
parent 7e83d70c8f
commit b434383ae8

View File

@ -38,4 +38,23 @@ scanf("%d%s%d", &i, s, &j);
--- ---
> **7.** Suppose that `str` > **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")
```