Schema on read is obsolete. Welcome metaprogramming..pdf
pop2.pdf
1. FILES USED IN C PROGRAM
• Source file
Contains source code of the program
File extension .c
Main () is the starting point of execution after successful compilation and running
• Header file
Create subroutines and store in header files
Use same routines in different programs by just compiling and linking to the object
file
Ends with .h extension
E.g. string.h, stdlib.h, math.h, conio.h
2. • Object file
Generated by compiler as a result of processing source code file
Contains compact binary code of the function definitions
Linker use these object files to produce executable files
With .o extention
• Executable file
Generated by the linker
With .e extention
3. Compiler & Linker
Compiler
• Source file is processed by a special program called compiler
• Translated source code to object code
• Obj code contains the machine instructions for the CPU and calls to the operating system
API(application program interface)
Linker
• Object file is not an executable file
• Obj file is processed with another program called linker
• Output of obj file is an executable /runnable file.
4. Overview of compilation &Execution Process
compi
ler
Linker
Object
files
Source file
Executa
ble files
files
Library
files
6. Programming Paradigms
•Fundamental style of programming that defines how the structure and
basic elements of a computer will be built
•The style of writing program and the set of capabilities and limitations
of programming language depends on programming paradigm it
supports
7. • In sequence of their application programming paradigms can be classified as
1. Monolithic Programming- emphasizes on finding a solution
e.g. Assembly Language, BASIC consist of global data and sequential code
Global data can be accessed and modified from any part of the program which
possess a serious threat to its integrity.
Sequential code – all instructions are executed in the specified sequence
To change the sequence of instructions ‘jump’ or ‘goto’ statements are used.
Monolithic program has just one program module as they do not support the concept
of subroutines.
All the actions required to complete a particular task are embedded within the same
application itself which makes the program large and also makes it difficult to debug
and maintain
So used for very small and simple applications
8. ADB 10
BDB 20
SUM DB?
MOV AX,A
ADD AX,B
MOV SUM,AX
JMP STOP
………
STOP EXIT
Global data
Sequential code with
JMP instructions
9. 2. Procedural Programming
• Program is divided into subroutines that can access global data
• To avoid repetition of code each subroutine performs a well defined task.
• More emphasis is given on the code and least importance to data
Disadv:
• Not data –centered
• Global data is shared and therefore may get inadvertently modified
• Main focus is on functions
10. 3. Object Oriented Programming
• It treats data as a critical element in the program development and restricts its
flow freely around the system
• Oop is task and data based
• All the relevant data and tasks are grouped together in entities known as
objects.
• New data and functions can be easily added as and when required.
Obj
1
Obj
4
Obj
3
Obj
2