Introduction to C programming/Hello World

From Wikiversity
Jump to navigation Jump to search

If you have not installed the applications cited in the Software Needed section, please do so before moving on!

Hello World[edit | edit source]

The first application that almost every programmer begins with is the "Hello World" application. This is a very simple application that only prints a line of text to the terminal window. This lesson will demonstrate the basic principles and techniques that are used when designing more in-depth applications.

The process is simple: open your text editor, (emacs, Xcode, etc...) and type in the following text:

  #include <stdio.h>
  int main ()
  {
    printf("Hello World!\n");
    return(0);
  }

Next, save your text file as "hello.c" or something similar. It is very important that the file has the extension ".c" instead of anything like ".doc" or ".txt".

--Mashedmeat 04:37, 11 March 2009 (UTC)