C Program - How to Execute

<<Previous

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.

    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.

    There are various compilers in the market. Popular C compiler is gcc. However, gcc compiler can not run directly on windows. You need to install Cygwin in order to run gcc compiler. Once installed, you can run gcc. This compiles C program and creates .obj file

    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;
    }
    
    

    If you are using Windows, Please refer to the section for detailed instructions on setting up C environment: https://www.krivalar.com/C-Coding-On-Windows


    << Previous

    Next >>







C Program - How to Execute

<<Previous

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.

    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.

    There are various compilers in the market. Popular C compiler is gcc. However, gcc compiler can not run directly on windows. You need to install Cygwin in order to run gcc compiler. Once installed, you can run gcc. This compiles C program and creates .obj file

    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;
    }
    
    

    If you are using Windows, Please refer to the section for detailed instructions on setting up C environment: https://www.krivalar.com/C-Coding-On-Windows


    << Previous

    Next >>







Learn about Hashing and Hash table

Learn Expression Tree

OS Kernel Architecture

OS Arcitecture of Windows, Linux and MacOS

Learn OS scheduling Algorithms


Krivalar.com © 2017