1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

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,276
    Likes Received:
    364
    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,276
    Likes Received:
    364
    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,276
    Likes Received:
    364
    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