Facebook

Hello [Programming] World!

There is a question on Quora, 'what is the greatest computer program written?'.
There are many great answers such as 'landing system of the Apollo 11', which was written by Margaret Hamilton, Linux Kernel , GNU C compiler, CERN web server etc. No doubt these programs are really great.  Linux kernel surely has changed the world but no program has changed the world more than 'Hello World' did. This simple program has set many brilliant programmer on a voyage to the beautiful world of coding and programming. This is the first tiny step of any programmer marking the beginning of a journey with ups (code compiled successfully) and downs (segmentation fault). 



Printing 'Hello World!' is every beginner and every newbie' first program (in most of the cases). Every new language you learn, the first program you write is printing 'hello world'. This happened with me atleast. 

Do you know the history behind this trend? 


First ever documented use of this iconic statement is found in a 1974 Bell Laboratories internal memorandum by Brian Kernighan, Programming in C: A Tutorial.

First known version of program is as below -

   1:  main( ) {
   2:          printf("hello, world");
   3:  }

The C version was adapted from Kernighan's 1972 A Tutorial Introduction to the Language B, where the first known version of the program is found in an example used to illustrate external variables:


   1:  main(){
   2:    extrn a,b,c;
   3:    putchar(a); putchar(b); putchar(c); putchar('!*n');
   4:    }
   5:   
   6:  a 'hell';
   7:  b 'o, w';
   8:  c 'orld';


See the question title (URL) in below image.


It is indeed true. Feeling of the first successfully compiled program is unmatched.

Hello World program in different language:

1. C

   1:  int main() {
   2:      printf("Hello World!");
   3:      return 0;
   4:  }

2. Java

   1:  public class HelloWorld
   2:  {
   3:      public static void main(String []args) {
   4:          System.out.println("Hello World!");
   5:      }
   6:  }

3. Python

print "Hello World!\n"

4.  C++

   1:  #include <iostream>
   2:   
   3:  using namespace std;
   4:   
   5:  int main()
   6:  {
   7:     cout << "Hello World" << endl; 
   8:     
   9:     return 0;
  10:  }
  11:   

5. Php (save file as main.php and place in www/html folder)

   1:  <html>
   2:  <head>
   3:  <title>Online PHP Script Execution</title>
   4:  </head>
   5:  <body>
   6:  <?php
   7:     echo "&lt;h1>Hello, PHP!</h1>";
   8:  ?>
   9:  </body>
  10:  </html>

Let us know what is your favorite programming language?

Share this among your friends.

2 comments: