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

    ysr shk

    ysr shk

    @ysr-shk-8AjUTB
    Updated: Oct 18, 2024
    Views: 1.0K
    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.
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • nareshkumar6539

    MemberApr 23, 2012

    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
    Are you sure? This action cannot be undone.
    Cancel
  • ysr shk

    MemberApr 23, 2012

    #-Link-Snipped-#

    thaNx it is really useful for me.
    Are you sure? This action cannot be undone.
    Cancel
  • Ankita Katdare

    AdministratorApr 29, 2012

    Hi,

    Could you check if either of these work?

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

    2.
    int main(int argc, char **argv){if (printf("Hello world!\n")) {}}
    Are you sure? This action cannot be undone.
    Cancel
  • ysr shk

    MemberApr 29, 2012

    #-Link-Snipped-#
    hey ur first way not works

    and second way is same as #-Link-Snipped-#
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register