FILES USED IN A C PROGRAM:
In C four types of files are used while
writing and executing. They are
Source code file
•
The source code file
contains the source code of the program. The file extension of any C source
code file is “.c”. This file contains C source code that defines the main
function and maybe other functions. The main() is the starting point of
execution when you successfully compile and run the program. A C program in
general may include even other source code files (with the file extension .c).
Header
Files
•
When working with large
projects, it is often desirable to make sub-routines and store them in a
different file known as header file. The advantage of header files can be
realized when
a) The
programmer wants to use the same subroutines in different programs.
b) The
programmer wants to change, or add, subroutines, and have those changes be
reflected in all other programs.
•
Conventionally, header
files names ends with a “.h” extension and its name can use only letters,
digits, dashes, and underscores.
•
While some standard header
files are available in C, but the programmer may also create his own user
defined header files
Object Files:
•
Object files are generated
by the compiler as a result of processing the source code file. Object files
contain compact binary code of the function definitions. Linker uses this
object file to produce an executable file (.exe file) by combining the of
object files together. Object files have a “.o” extension, although some
operating systems including Windows and MS-DOS have a “.obj” extension for the
object file.
Binary
Executable File
•
The binary executable file
is generated by the linker. The linker links the various object files to
produce a binary file that can be directly executed. On Windows operating
system, the executable files have “.exe” extension.
Comments
Post a Comment