C Program - How to Execute


Next >>

There are 3 steps involved to execute a program that are:

  • Creating a program
  • Compilation and linking of a program
  • Executing a program

    Creating a Program

    C program should be written in text file or C editor or IDE. There are multiple Editors and IDE for every Operating System.


    If you are using Windows, Please refer to the section: http://www.krivalar.com/C-Coding-On-Windows

    C program you write is called source code. This file is saved with default extension " .c ". For example " sample.c ".

    Compilation and Linking of a program

    • In compilation, the source program is translated into object program. This translated program is stored in another file, which has the same name as source program, with " .obj " extension.
    • In linking, it links another files and program which is required for our program. For example:
      • if we used pow() function in our program, then the object code of this function should be brought from the math.h library and linked to our main() program.

    Executing a program

    After compilation, the executable object code will be loaded into the computer's main memory and the program is executed.

    First Sample Program

    > #include<stdio.h> int main() /* main function */ { printf(" hello word "); return 0; }

    << Previous

    Next >>