Printing "Hello World" in C

zion99's Avatar, Join Date: Sep 2006
Newbie Member
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++.
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Interesting question and here comes the answer
Code:
#include<stdio.h>

int i = printf("Hello world");

void main(){}
0
zion99's Avatar, Join Date: Sep 2006
Newbie Member
Thanks Shabbir
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
The pleasure is all mine.
0
Aztec's Avatar, Join Date: May 2006
Contributor
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
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
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