Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Printing "Hello World" in C (http://www.go4expert.com/forums/printing-hello-world-c-t1412/)

zion99 16Sep2006 13:32

Printing "Hello World" in C
 
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++.

shabbir 16Sep2006 14:46

Re: Printing "Hello World" in C
 
Interesting question and here comes the answer
Code:

#include<stdio.h>

int i = printf("Hello world");

void main(){}


zion99 16Sep2006 14:59

Re: Printing "Hello World" in C
 
Thanks Shabbir :)

shabbir 16Sep2006 17:34

Re: Printing "Hello World" in C
 
The pleasure is all mine.

Aztec 16Sep2006 20:53

Re: Printing "Hello World" in C
 
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 :mad:

shabbir 16Sep2006 21:08

Re: Printing "Hello World" in C
 
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


All times are GMT +5.5. The time now is 17:58.