Canocical hello world 
Author Message
 Canocical hello world



Quote:
>ObC: What is the canonical first program to write in C?  Is it
>        "Hello World\n" or
>        "Hello, world\n" or
>        "hello world\n" or what?
>Please cite authoritative sources or use statistics.

I don't know if there is a more hoary and authoritative source than
K&R1.  It is certainly part of the canon, even though it is the "Old
Testament."

Kernighan, Brian W. & Ritchie, Dennis M., _The C Programming Language_,
1978, Prentice Hall, Inc.
p. 5:
    The first program is the same for all languages:
        Print the words
            hello, world

p. 6:
    main()
    {
        printf("hello, world\n");
    }

The _second program_ is
p. 7:
    main()
    {
        printf("hello, ");
        printf("world");
        printf("\n");
    }

--

* Chicago, IL (USA)    



Mon, 03 Aug 1998 03:00:00 GMT  
 Canocical hello world

Quote:



>>ObC: What is the canonical first program to write in C?  Is it
>>        "Hello World\n" or
>>        "Hello, world\n" or
>>        "hello world\n" or what?
>>Please cite authoritative sources or use statistics.
>I don't know if there is a more hoary and authoritative source than
>K&R1.  It is certainly part of the canon, even though it is the "Old
>Testament."

[snip]

I'm nitpicking, but I find it unlikely that the first C program that
ran uses a beast like 'printf()'.  It probably did say something to
the world, but I am guessing it is either a severely watered down
version of 'printf()', or something much simpler like 'puts()' and
'putchar()'.  The compiler writer has to test it with something
simple first, right?

(Lighten up ;) )

--

Opinions stated herein are my own.



Tue, 04 Aug 1998 03:00:00 GMT  
 Canocical hello world




Quote:
>I'm nitpicking, but I find it unlikely that the first C program that
>ran uses a beast like 'printf()'...

No, you are not nitpicking.  You are differently interpreting the
original question from schweikh:

Quote:
>>>ObC: What is the canonical first program to write in C?  Is it

                    ^^^^^^^^^
Which I read as "of, relating to, or forming a canon."  That is the
reason for my including the first program from K&R1 which is one of
the first parts of the C canon.

One could read `canonical' as "reduced to the simplest or clearest
schema," in which case, something like:

         main() {}

would come close.

--

* Chicago, IL (USA)    



Sun, 09 Aug 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. a hello world encryption

2. The Program Only Harder Then Hello World...

3. Hello World not working

4. Hello World Problem

5. Newbie Question about Hello World

6. Hello World

7. Hello world without semicolon

8. Hello World

9. Hello World problems

10. Hello World Web service

11. Hello world!

12. Help with Hello World

 

 
Powered by phpBB® Forum Software