Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The following function calls supposedly write a single new -line character, but

ID: 3823992 • Letter: T

Question

The following function calls supposedly write a single new -line character, but some are incorrect. Identify which calls don't work and explain why. a) printf("%c", ' '); b) printf("%c", " "); c) printf("%s", ' '); d) printf("%s", " "); e) printf(' '); f) printf(" "); g) putchar(' '); h) putchar(" "); i) puts(' '); j) puts(" "); k) puts(""); Suppose that p has been declared as follows; cahr *p = "abc"; which of the following function calls are legal? Show the output produced by each legal call, and explain why the other are illegal. A) putchar(p); b) putchar (*p); c) puts (p); d) puts (*p);

Explanation / Answer

Yes it works ' ' denots character

No it works " " denots string %c means accepts character

No it works ' ' denots character %s means accepts string

Yes it works " " denots string%s means accepts string

No it works ' ' denots character printf accepts string

Yes it works " " denots string printf accepts string

Yes it works ' ' denots character putchar accepts character

No it works " " denots string putchar accepts character

No it works ' ' denots character puts accepts string

Yes it works " " denots string puts accepts string

Yes is works puts by default prints new line

Question 2: Answer is C)puts(p);

Gives erroe expected 'int' but argument is of type 'char *'

prints only sigle character a

prints the character of string abc

Gives error expected 'const char *' but argument is of type 'char'

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote