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.

Replies

  • nareshkumar6539
    nareshkumar6539
    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.
    main()
    {
    if(printf("computer science engineering"))

    }
    if you execute the above program it will display computer science engineering as output
  • ysr shk
    ysr shk
    #-Link-Snipped-#

    thaNx it is really useful for me.
  • Ankita Katdare
    Ankita Katdare
    Hi,

    Could you check if either of these work?

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

    2.
    int main(int argc, char **argv){if (printf("Hello world!\n")) {}}
  • ysr shk
    ysr shk
    #-Link-Snipped-#
    hey ur first way not works

    and second way is same as #-Link-Snipped-#

You are reading an archived discussion.

Related Posts

halo everybody, i have this idea of a project and would really requests for your comments and support. i have witnessed the long queues in students mess and the main...
halo everybody, i have this idea of a project and would really requests for your comments and support. i have witnessed the long queues in students mess and the main...
Ford's EcoSport looks to be one promising automobile that might just fill the gap between the sedans and SUVs at a price point that would make it affordable to the...
Chevrolet's SUV Captiva is going to be rendered a facelift to attract more customers and now new MPV Chevrolet Enjoy is also paving its way in the Indian car market....
Hi fRienDs, I want to find the type of RAM,which my system have without opening the system. As we can know the how much hard disk a particular system have...