0
naimish's Avatar
Banned
Quote:
Very good. And what is the source code of that C program? It's true Shabbir didn't actually say "and post the code here", but that could reasonably be implied, also how is he going to judge your code if he can't see it?
0
Kshiteej's Avatar, Join Date: Jul 2009
Contributor
Hi Shabbir,

What is the answer of this question?
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Looks like Saswat but I am not on Linux and so is not able to verify what he said.
0
SaswatPadhi's Avatar, Join Date: May 2009
~ Б0ЯИ Τ0 С0δЭ ~
It can be verified on Windows also
All chars in the file-name are perfectly fine on Windows XP.

BTW, her is the source :: http://everything2.com/title/The+Wor...st+Hello+World

And, I think xpi0t0s and/or someone else might verify and post the result here too.

0
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
I haven't said anything because I don't think it would work. But I don't have a Linux or MinGW installation handy to try it.

Saswat, to convince me* you should post a screen shot that shows it working. Use four commands:
ls
cat <filename>
<the gcc command>
<invoke the executable so we can see the output>

*Not that it's me that needs convincing. But I think this would convince anyone.
0
naimish's Avatar
Banned
So, what's the final answer for this ?
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Quote:
Originally Posted by naimish View Post
So, what's the final answer for this ?
Saswat's
naimish like this
0
SaswatPadhi's Avatar, Join Date: May 2009
~ Б0ЯИ Τ0 С0δЭ ~
Thanx for accepting my answer
But ...
Quote:
Originally Posted by SaswatPadhi View Post
I googled and found this as the shortest possible. As, the source file is only 1 byte !

Steps :
(1) Create a new empty file named : "void main(){puts(Hello, World!);}c.c"
(2) Open the file with any text editor and write only one char "A" to the file and save it.
##That's our program Only 1 char content !
(3) To compile it, use gcc with flags "-DA=__FILE__ -Dc=// -istdio.h void*.c".

Not sure if it works. I'll test and post.
As I mentioned, "Not sure if it works".
And as xpi0t0s thinks it won't work, it might not. I just read it here : http://everything2.com/title/The+Wor...st+Hello+World

Anyway, one thing is clear from the code that it is not according to the latest ANSI C specs, 'cuz it still uses void main() and not int main().

Anyway, the shortest working (confirmed) "Hello G4EF" program in ANSI C will be :
Code: C
main(){puts("Hello G4EF");}
which is still the shortest (29 bytes) even if my previous answer is rejected

NOTE that you don't need to do these :
(*) #include <stdio.h>
(*) int in-front of main.
(*) return 0
(*) New lines at end of statements
They reduce the code length further.
0
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
I think it won't work because there are missing quotes:
Code:
puts(Hello, World!)
Apart from that though the principle of putting one character in the C file and using a -D to place the code is absolutely fine, in fact this is what one of the IOCCC winners did (although his file was 3 characters long: A;<eof>).
0
naimish's Avatar
Banned
Congrs SP