Hello World Tutorial (revision 120925-r01KI)

Return to Lab 02

  • Create cobahello.c file using vi
    $ vi cobahello.c
  • Type the below program. Replace 1202000818 with your student ID. Replace TOKEN with your token.
    //1202000818 sudah mengerjakan program "Hello, World!" 
    #include <stdio.h>
    int main ()
      printf ("Hello World!\n");
  • Save the program.
  • Compile cobahello.c using gcc
    $ gcc cobahello.c
    $ ls -al
  • You will see a new file as a result: a.out. We can run this program using:
    $ ./a.out
  • We can also decide the file name for our executable. This time we will re-compile the program and make the executable named cobahello
    $ gcc -o cobahello cobahello.c
    ls -al
  • A new file named cobahello will be the result of the compilation. We can run this program with the same way like before.
    $ ./cobahello
  • This is the end of Hello World Tutorial.

Return to Lab 02
Kembali ke Wiki