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

This commit is contained in:
zleyyij 2024-11-03 14:25:04 -07:00
parent 0e2586459f
commit 7e83d70c8f

View File

@ -6,7 +6,8 @@ e. `printf('\n');` - `printf`'s first argument should be a string, not a `char`.
h. `putchar("\n");` - `putchar`'s first argument should be a `char`, not a string. h. `putchar("\n");` - `putchar`'s first argument should be a `char`, not a string.
i. `puts('\n');` - `puts`'s first argument should be a string, not a `char`. i. `puts('\n');` - `puts`'s first argument should be a string, not a `char`.
j. `puts("\n");` - `puts` will write a newline after writing a string, so this will write two newlines. j. `puts("\n");` - `puts` will write a newline after writing a string, so this will write two newlines.
<hr>
---
> **2.** Suppose that `p` has been declared as follows: > **2.** Suppose that `p` has been declared as follows:
```c ```c
@ -22,10 +23,19 @@ putchar(*p);
puts(p) puts(p)
// D - Illegal, `puts` accepts a pointer to a null terminated string, not a `char`. // D - Illegal, `puts` accepts a pointer to a null terminated string, not a `char`.
``` ```
<hr>
---
> **3.** Suppose that we call `scanf` as follows: > **3.** Suppose that we call `scanf` as follows:
```c ```c
scanf("%d%s%d", &i, s, &j); scanf("%d%s%d", &i, s, &j);
``` ```
> If the user enters `12abc34` `56def78`, what will be the values of `i`, `s`, and `j` after the call? (Assume that `i` and `j` are `int` variables and `s` is an array of characters.) > If the user enters `12abc34` `56def78`, what will be the values of `i`, `s`, and `j` after the call? (Assume that `i` and `j` are `int` variables and `s` is an array of characters.)
- `i`: `12`
- `s`: `"abc34"`
- `j`: `56`
---
> **7.** Suppose that `str`