View Feed
Coffee Room
Discuss anything here - everything that you wish to discuss with fellow engineers.
12834 Members
Join this group to post and comment.
ysr shk
ysr shk • Apr 24, 2012

Is it possible to print something in 'C' without semicolon

Hello friends,
One of my friend asked me that is it possible to print something in 'C' without semicolon.

I had tried more things like turnary operators,MACROs.I cant succeed.
But as you any statement in C will terminate with semicolon so I failed.

Is there any way to print in C without using semicolon?

Thanking You.
Yes it is possible.If you want to print something on console with out using semicolon then write printf() statement in if clause as a condition.
if(printf("computer science engineering"))

if you execute the above program it will display computer science engineering as output
ysr shk
ysr shk • Apr 24, 2012

thaNx it is really useful for me.
Ankita Katdare
Ankita Katdare • Apr 29, 2012

Could you check if either of these work?

int main(int argc, char *argv[static printf("Hello World\n"), 0]){}

int main(int argc, char **argv){if (printf("Hello world!\n")) {}}
ysr shk
ysr shk • Apr 29, 2012
hey ur first way not works

and second way is same as nareshkumar6539

Share this content on your social channels -