Showing posts with label Compiling C Program. Show all posts
Showing posts with label Compiling C Program. Show all posts

Sunday, 4 March 2012

Preparation of C Program for Execution



Dear readers,
              In this lesson we tell you about the some necessary steps to prepare C program for execution..
SO FRIENDS LETS START LESSON
  • Some steps which are taken to prepare a C program for execution are :-
  1. Creating & Editing C Program
  2. saving C program
  3. Compiling C program
  4. Linking C program
  5. Loading C program
  6. Executing C program
  • Creating & Executing C program :-
                                                   The first step is to create and edit the source program in C. The C program is usually and edited in Turbo C editor.
  • Saving C program :-
After writing or editing the source program, it is saved on the disk as text file with an extension ".c".
  • Compiling C program :-
In this step, the source program is compiled. The source program is converted into machine code. The C compiler is used to translate  the C program source code into the machine code.
  • Linking C program :-
In this step, the Linker links object file produced by the compiler to many other library files.
 After linking the object code  to the libraries, an executable file with extension EXE is created.
  • Loading C program :-
                    In this step the loader loads the executable file from disk into memory for execution. The program must be loaded into memory for execution.

  • Executing C program :-
In this step, the program is executed on the computer. The CPU fetches instructions of program from memory one by one and takes action on them.


Monday, 20 February 2012

Compiling C Program


Dear readers,
       In this lesson we tell you how to compile C Program ?....
SO FRIENDS LETS START LEARNING
  • Compiling C Program :-
                  You write the source code of the program by following rules of the programming language (i.e. C language).

     
 The source Code is not understandable by the computer. The source code must be translated into machine code before running on the computer. The process of translating source code into machine code is called compiling.
       The C compiler is used to translate the C program source code into the machine code. The translated code is called object code.
 when C compiler translates the source code, a new file created for object code with extension "obj". The first part of the name of object file is same as that of source file. 
For Example :-
           If source file name is "test.c", then object file name will be "test.obj".
                             To complete the C program source code into object code in Turbo C IDE, follow these steps.
  • Press Shortcut Alt+F9
  •                  OR
  • Select Compile command from compile of menu bar.
If there is no error in the source code, it will be translated to object code successfully. If there are errors in the source code, compiler will not compile the source code and will report about the errors in the source code. All errors must be removed from the source code before creating the object code of the source code.