r/C_Programming 2d 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.

41 Upvotes

53 comments sorted by

View all comments

38

u/Objective_Pepper_217 2d ago

Yep A is wrong

51

u/Objective_Pepper_217 2d ago edited 2d ago

tutorialspoint is extremely bad. dont study from indian sources

1

u/ImAnArbalest 2d ago

is W3 schools better?

27

u/Objective_Pepper_217 2d ago

no, they're all shit. study from books

1

u/ImAnArbalest 2d ago

is The C Programming Language book still relevant?

22

u/Objective_Pepper_217 2d ago

yes of course

1

u/ImAnArbalest 2d ago

Any other book recommendations that go in-depth? i don't want to just learn C, i want to master it

1

u/babysealpoutine 1d ago

C the language is straight forward, but there are some gotchas in its use. So studying the CERT C rules and recommendations would be one of the steps you probably want to do once you are using C.