Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/ekhaliya/public_html/topcse/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: Cannot modify header information - headers already sent by (output started at /home/ekhaliya/public_html/topcse/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php:340) in /home/ekhaliya/public_html/topcse/wp-content/plugins/sg-cachepress/core/Supercacher/Supercacher_Helper.php on line 77
C TUTORIALS - Steps to Run C Program - Top CSE

C TUTORIALS – Steps to Run C Program


In this post we will learn about how does the C Program run.

The stages in the life cycle of a C Program are:

  • Writing of the program
  • Compiling of the program
  • Linking of the program
  • Execution of the program

Now let us understand these phases:

Writing of the program

The first phase is the program writing in the life cycle of every C program. This phase is also known as Editing phase. You write the program in the text editor provided by the C language. To write a program the syntax and the grammar rules of the C language should be taken care of in order to make an effective program. This program is called the source program or the source code. And the file in which the program is saved is known as the source file. This file is often saved with the extension .c or .cpp in C programming language.

Compiling of the program

The source code cannot be executed immediately after writing. Firstly it has to be translated into binary code or binary form. As we all know that the computer can only understand machine language, so there is a need to translate the source code into the machine acceptable language or the computer acceptable language. For this translation, a compiler is required by the C language. This process is known as compiling of the C program. The output of this phase is the object code or the object file with the extension .obj.

Linking of the program

The C language provides many predefined functions in the C Standard Libraries which are used in the C program. In the linking phase, the program code is linked to these predefined functions so that the functioning of them can be used in the C Program. For this purpose, a software program called linker is used. The standard input and output functions are contained in the stdio.h library, so the most basic program will require linking for these predefined functions. The executable files with the extension .exe are the output of this linking phase.

Execution of the program

The final step in the life cycle of the C program is the program execution. In this phase, the instructions stored in the .exe executable file of the C Program are processed to finally produced the output of the program.

This sums up the life cycle of the C Program.

Another important part of the Program Execution process is the- ERRORS

Error is an important part of the execution process of the C Program. If you get an error message after the compiling phase or the program output is not as expected when you finally run the C Program, then the source file – the .c file – needs to be modified accordingly by checking the grammar rules and the syntax rules and then the whole execution process has to be followed to run the program perfectly and get the expected output.

%d bloggers like this: