Printing "Hello World" in C

Discussion in 'C' started by zion99, Sep 16, 2006.

  1. zion99

    zion99 New Member

    Joined:
    Sep 16, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Hi all,

    Has anybody tried printing "Hello" without including any code in the body of the main ?
    i.e.
    main(){}
    I cud not get it as to how to implement the above in C or C++.
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Interesting question and here comes the answer
    Code:
    #include<stdio.h>
    
    int i = printf("Hello world");
    
    void main(){}
    
     
  3. zion99

    zion99 New Member

    Joined:
    Sep 16, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Thanks Shabbir :)
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    The pleasure is all mine.
     
  5. Aztec

    Aztec New Member

    Joined:
    May 9, 2006
    Messages:
    90
    Likes Received:
    0
    Trophy Points:
    0
    void mainer's are doomed :mad:
     
  6. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    I totally agree on that Aztec but there are some habits which are hard to change and nowadays I dont tend to write lots of main functions
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice