Necessary Steps to Prepare a C Program for Execution

 

Necessary Steps to Prepare a C Program for Execution


    Different necessary steps are taken to prepare a C program for execution. These steps are executed in sequence.
Different steps to prepare C program for execution are as follows:

1. Creating & Editing a C Program

        The first step is to create and edit a new program. It includes writing, modifying, and deleting program statements. This process is performed by using a text editor like Notepad, Wordpad, etc. Most compilers provide their own text editor for writing source code of the C program.

2. Saving a C Program

       The process of storing the program on disk is known as saving. A program should be saved on disk to be used repeatedly. The C program is saved with .c extension.

3. Compiling a C Program

       The process of converting the source program to the object program is known as compiling. The program saved with the .c extension contains the statement of C language. It is known as the source program. The source program cannot be executed by computer directly. A compiler converts the source program into an object program and saves it in a separate file. The object program is saved with the .obj extension.

       The source program cannot be compiled if it contains any syntax error. The compiler generates an error message to describe the cause of the error. All errors must be removed to successfully compile a source program.


steps to prepare c program for execution
Figure: Steps to prepare C program for execution


4. Linking a C Program

       The process of linking library files with object program is known as linking. These files are used to accomplish different tasks such as input/output. A library file must be linked with the object file before the execution of the program. A program that combines the object program with additional library files is known as linker. It is part of the C++ compiler.

       The linker generates an error message if the library file does not exist. A new file is created with .exe extension if the process of linking is successful. This file is known as executable file and can be executed by the computer directly

5. Loading a C Program

       In this step, the loader loads the executable file into the memory for execution. A program must be loaded in the memory in order to execute it. A program that places an executable file into the memory is known as loader.

6. Executing a C Program

       The process fo running an executable file is known as executing. The C++ program can be executed after compiling and linking. In this last step, the program is executed. The instructions written in the program are executed by the computer.

Post a Comment

2 Comments