SUBJECT: C TOPIC: Executing a C program
WRITTEN BY: DR.SRINIVAS YADLAPATY
Qualification: Mtech - Computer Science(JNTU-Hyderabad),
PHD in Computer Science and Engineering
Mobile number: 9989601027
Mail id:
[email protected]Experience(16 years): Worked as Assistant Professor, Associate Professor in
several reputed engineering colleges(Avanthi, Sri Indu, SVIET, ST.Mary’s,
Brilliant, Siddhartha engineering colleges in Hyderabad), Guest faculty for
MBES Engineering college – Ambajogai - Maharashtra for java, Guest faculty
for RK Engineering college - Vijayawada for Java, Guest faculty for MVR
engineering college - Vijayawada for Java , Software Engineer in Grdemettle,
Senior Software Engineer in Yaaltech, Working for Harvest online, Mumbai
on Java and Python, Working for Infimind solutions, Bangalore on Python and
Java. Currently working for St Mary’s Engineering College, Hyderabad.
--------------------------------------------------------------------------------------------------------
Compilers, creating, compiling and executing a program:
Figure(1). C program execution
1. Text editor: The program can be written in any text editor such as
notepad, DOS editor, vi inUNIX, emacs in LINUX, IDEs(Integrated
Development Environment) like Code blocks etc. In IDEs we can not only
write but can also compile, run and debug the programs.
2. Source code: The program typed by a programmer in an editor or IDE is
known as a source code.
3. Steps: Steps involved as per Figure(1) are: create, save, compile,
execute.
4. Save: After typing the program it has to be saved with some name
followed with .c as an extension in bin folder normally.
5. Compilation: In normal Turbo C++ editor after saving the program we
need to compile with alt+f. The source program contains statements
that are to be translated into object codes. These object codes are used
for execution by the computer. If the program contains errors then it will
show such that we need to correct them again. If the program is
successfully compiled then it will create an object file(with extension
.obj). This object file is stored on a secondary storage device such as the
disk.
6. Execution: ctrl+f can be used so that both compilation and execution can
take place so that in this case we need not go with the previous step i.e.,
alt+f. The linking is also an essential process. It puts together all the
program files and functions(like pow(), sqrt() etc., that are required byb
the program. The object code of such functions are brought from the
respective header file library of the system and linked to the main()
program. After linking the program code is stored on the disk. The
program code generated is called the executable code.