Difficulty: Easy
Correct Answer: A
Explanation:
Introduction / Context:
Unlike string literals, a char array initialized from a literal is writable. This program modifies a local copy of the format string to change the conversion specification from decimal integer (%d) to character (%c) and then prints an ASCII/character code.
Given Data / Assumptions:
Concept / Approach:
For the %c conversion, printf outputs the character whose code is the integer argument. 65 in ASCII corresponds to 'A'. Therefore, the program prints 'A' followed by a newline.
Step-by-Step Solution:
Verification / Alternative check:
Change 65 to 97 and you will see 'a'. Revert the format to '%d' to see the decimal number printed.
Why Other Options Are Wrong:
Common Pitfalls:
Attempting to modify a string literal directly (undefined behavior) instead of modifying a writable array copy.
Final Answer:
A.
Discussion & Comments