How can we print "Hello World" in C or C++ without using a semicolon? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How can we print "Hello World" in C or C++ without using a semicolon?

This question was asked to me in an interview. I want to know then answer to this. Can anyone please help?

8th Apr 2018, 6:04 AM
Anusha Sinha
Anusha Sinha - avatar
5 Answers
+ 6
try this #include <stdio.h> int main(int argc, char *argv[printf("Hello, world!\n")]) {}
8th Apr 2018, 6:24 AM
᠌᠌Brains[Abidemi]
᠌᠌Brains[Abidemi] - avatar
+ 6
here is a example with c #include <stdio.h> int main() { if(printf("Printing strings without ';' semicolon")){} } https://code.sololearn.com/cGPWY7BfM1se/?ref=app
8th Apr 2018, 6:31 AM
Sudarshan Rai
Sudarshan Rai - avatar
+ 2
Thank you so much! @Brains
8th Apr 2018, 6:25 AM
Anusha Sinha
Anusha Sinha - avatar
0
Thank you all! All the codes work perfectly!!!
8th Apr 2018, 6:59 AM
Anusha Sinha
Anusha Sinha - avatar
0
I don't know in which way this would reflect how good someone is in using c++. Was this a warm-up question? https://code.sololearn.com/cY3MQDT1ONkO/?ref=app
8th Apr 2018, 7:57 AM
Alex
Alex - avatar