Execution of the C Program:-

 

Developing a program in a compiled language such as C requires at least four steps:

1. Editing (or writing) the program.

2. Compiling.

3. Linking.

4. Executing.

 

Step 1: Editing: (in turbo C Compiler use the command TC filename.c at dos (prompt)

         1. Write C program using Text Editor. Such as Notepad or Turbo C editor.

        2. Save program with an extension .C (F2 in Turbo C)

        3. File saved with .C extension is called as Source Program.

 

Step 2: Compiling: (In turbo C compiler use Alt + F9 Key)

 

1. Source Program with an extension .C is given as input to Compiler.

2.  Compiler checks for errors, if source code contains errors then goto step1 to modify the source program.

3. If source code is error free then Compiler Converts it into Object file with an extension obj and proceed to step3.

Step 3: Linking: (This Process is inbuilt with step2 in Turbo Compiler).

1. Object Program with an extension .OBJ is given as input to Linker.

2. Linker checks for errors, if object code contains errors then goto step1 to modify the source program.

3. If Object code is error free then linker converts .obj file into Executable file with an extension.exe.

 

Step 4: Executing: (Give filename.exe at dos prompt (or) CTRL + F9 Key in turbo C)

 

1. Executable file .exe is run at dos prompt or by GUI of Turbo compiler.

2. If any runtime error occurs then goto step1 to modify the source program.

3. If no run time error occur then the output will be displayed to the user. And the program is successful.

            In Summary The text editor produces .c source files, which go to the compiler that produces .obj object file, which go to the linker that produces .exe executable file. .exe file can be run by the user to get the output of the program.

 

The Pictorial representation of the above steps is

Comments

Popular posts from this blog

Structure of C-Language

Introduction Structure of C-Language