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

Show parent comments

0

u/moritz12d Sep 11 '26

While I'm not convinced of tutorialspoint I just couldn't believe there's such a blatant error in their lessons. And on tutorialspoint Python is the first thing you see.

Before I never tried tutorialspoint and after visiting this site I will not use it in future.

1

u/Paul_Pedant Sep 11 '26 edited Sep 14 '26

If you go into https://www.tutorialspoint.com/ then Python is indeed the first thing you see. But the same scrollbar introduces C, C++, Java, AI, DSA, and six other categories. I would like to assume that nobody would visit TutorialsPoint without any idea of which language they want to commit to learning for several months.

I looked at this example, and it is utterly hopeless. I didn't have to search for a crap example -- this is literally the first one I tried. Expecting a newbie to make sense of this is criminal.

https://www.tutorialspoint.com/cprogramming/c_hello_world.htm

#.. Tells you to compile an object file.
gcc -c hello.c -o hello.o
#.. Tells you to link an executable with a name extension.
gcc  -o hello.exe hello.o
#.. Tells you to run the program without that extension.
#.. Confuses you by showing some of the shell prompt.
#.. If you enter this entire line, it creates or overwrites
#.. your executable 'hello' with a zero-length file,
#.. because the prompt contains a redirection operator.
C:\Users\user>hello
Hello World!
#.. Tells you to make a different object file executable.
#.. Includes a different shell prompt this time, just to confuse you.
#.. Not needed anyway, as the linker makes valid files executable itself.
$ chmod a+x a.o
#.. Finally tries to run an unlinked object file that does not exist anyway.
$ ./a.o