vault backup: 2024-11-03 14:15:04
This commit is contained in:
parent
6a77276898
commit
a46466ade3
@ -6,3 +6,16 @@ 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.
|
||||||
|
|
||||||
|
> 2. Suppose that `p` has been declared as follows:
|
||||||
|
```c
|
||||||
|
char *p = "abc";
|
||||||
|
```
|
||||||
|
> Which of the following function calls are legal? Show the output produced by each legal call, and explain why all the others are illegal.
|
||||||
|
```c
|
||||||
|
// A - Not legal, because putchar accepts a `char`, not a pointer.
|
||||||
|
putchar(p);
|
||||||
|
// B - Legal, output: `a`
|
||||||
|
|
||||||
|
|
||||||
|
```
|
Loading…
Reference in New Issue
Block a user