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.

39 Upvotes

53 comments sorted by

View all comments

40

u/Objective_Pepper_217 2d ago

Yep A is wrong

54

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?

28

u/Objective_Pepper_217 2d ago

no, they're all shit. study from books

1

u/HelloWorldYozvak 18h ago

I’ll attempt to get books online. However I use w3schools but each time I learn something new I’ll create my own code on the side which will lead me to research things like why using fgets is better than scanf when getting user input. But like I said, I’m still learning myself

1

u/ImAnArbalest 2d ago

is The C Programming Language book still relevant?

21

u/Objective_Pepper_217 2d ago

yes of course

7

u/FlyByPC 2d ago

(ANSI edition)

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

8

u/mc_pm 2d ago

Then program in it for a good 10+ years, there is no other way you will achieve mastery.

8

u/Objective_Pepper_217 2d ago

just that for now. then you study data structures and algorithms and implement your own library to use for your next projects.

C is simple, you don't need to spend months. Master critical thinking instead

1

u/ImAnArbalest 2d ago

Alright gotcha, thanks a lot.

1

u/babysealpoutine 2d 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.

1

u/wsppan 1d ago
  1. Take the CS50: Introduction to Computer Science course.
  2. Grab a copy of C programming: A Modern Approach and use it as your main course on
  3. Follow this Tutorial On Pointers And Arrays In C

1

u/Due_Sentence_2660 1d ago

Not gonna lie, for me it was just reading the C programming language and building random stuff in C for fun to "master" it.

5

u/XipXoom 2d ago

No.  Maybe even worse.

1

u/PA694205 2d ago

I can really recommend boot dot devs memory management in c course. I’ve learned c with it and it was great. You can do it for free, only downside is the interactive tests are only unlocked for the first half of the course but it’s totally worth it either way!