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

0

u/[deleted] Sep 10 '26

[deleted] — view deleted comment

5

u/aocregacc Sep 10 '26

gcc stopped allowing this conversion by default in gcc 14, and msvc doesn't even let the long character constant through. Which is why the question is just bad.

0

u/[deleted] Sep 10 '26

[deleted] — view deleted comment

1

u/aocregacc Sep 10 '26

the int to pointer

2

u/ImAnArbalest Sep 10 '26

sorry i don't quite understand everything as i am using codeblocks on windows, and the compiler warning is much shorter than yours, but i assume we get the same result? when you run it there is no output?

-4

u/Shaanphin Sep 10 '26

Cmon dude, who does ```gcc -o scratch scratch.c``` instead of ```gcc scratch.c -o scratch```? It's killing me to look at this

0

u/[deleted] Sep 10 '26

[deleted] — view deleted comment

3

u/Shaanphin Sep 10 '26

A true gentleman, thank you :)

-1

u/tharold Sep 11 '26

-o enables some checks that otherwise would need to be enabled explicitly. -Wall is also recommended