Printing "Hello World" in C

Newbie Member
16Sep2006,13:32   #1
zion99's Avatar
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++.
Go4Expert Founder
16Sep2006,14:46   #2
shabbir's Avatar
Interesting question and here comes the answer
Code:
#include<stdio.h>

int i = printf("Hello world");

void main(){}
Newbie Member
16Sep2006,14:59   #3
zion99's Avatar
Thanks Shabbir
Go4Expert Founder
16Sep2006,17:34   #4
shabbir's Avatar
The pleasure is all mine.
Contributor
16Sep2006,20:53   #5
Aztec's Avatar
Quote:
Originally Posted by shabbir
Interesting question and here comes the answer
Code:
#include<stdio.h>

int i = printf("Hello world");

void main(){}
void mainer's are doomed
Go4Expert Founder
16Sep2006,21:08   #6
shabbir's Avatar
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