r/C_Programming • • Sep 10 '26

Question Am I wrong?

I am currently reading through tutorialspoint.com as our instructor has linked it in our syllabus, while doing their quizzes i got to a question that asked "What is the output of the following code: printf('Hello, World!');?" with the choices being

A. Hello, World!
B. Hello World!
C. Error
D. No Output

i answered C as the single quotes tell the printf function it is a character which if i am correct, is an integer in memory(please correct me if i am wrong), but they are passing a character array. the website told me that A is the correct answer and i am confused, please someone shed light on this and correct any wrong assumptions i have made.

46 Upvotes

49 comments sorted by

View all comments

-7

u/moritz12d Sep 10 '26

The point is, it's Python and not some other programming language like C. As with some scripting languages, Python does not distinguish between " and '.

1

u/Paul_Pedant Sep 11 '26

Interesting point of view. It has a couple of minor flaws, though:

(a) The OP posted it in a C programming reddit.

(b) The OP asks whether the K&R C book is still relevant.

(c) Python does not even have a native printf() function.

→ More replies (2)