From a46466ade3b43626a53d16e339df2966c4a6404f Mon Sep 17 00:00:00 2001 From: zleyyij <75810274+zleyyij@users.noreply.github.com> Date: Sun, 3 Nov 2024 14:15:04 -0700 Subject: [PATCH] vault backup: 2024-11-03 14:15:04 --- .../ECE1400/Chapter 13 Exercises.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/education/software development/ECE1400/Chapter 13 Exercises.md b/education/software development/ECE1400/Chapter 13 Exercises.md index aa0c798..03deb8c 100644 --- a/education/software development/ECE1400/Chapter 13 Exercises.md +++ b/education/software development/ECE1400/Chapter 13 Exercises.md @@ -5,4 +5,17 @@ c. `printf(%s, '\n');` - This is invalid because it's trying to display a `char` 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. 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. \ No newline at end of file +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` + + +``` \ No newline at end of file