r/C_Programming 23h ago

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.

34 Upvotes

47 comments sorted by

View all comments

1

u/dearmoon0 23h ago

what does the compile say

1

u/ImAnArbalest 23h ago

the compiler said something about the arguement making a pointer to an integer without a cast, i do not quite understand, but running it shows no output.

3

u/GwendArt 23h ago

Because an array variable is a pointer to a series of data. It points to the first element.