6. Each and every statement of C program need
to convert in such a format so that processor
can understand it.
Ex: Processor does not understand what is
“printf”
A program that translate HLL language to
machine level language is known as compiler
7. The four stages for a C program to become
an executable
• Pre-processing
• Compilation
• Assembly
• Linking
8. Begins with „#‟
Carried out prior to compilation
Macro substitution
Comments are removed
Expansion of the included files
Saved in .i file
/* hello.c */
#include<stdio.h> /*Preprocessor directives*/
int main()
{
printf(“Hello Worldn”);
return 0;
}
9. “hello.i” is the input to Compiler
Compiled into intermediate stage (assembly)
i.e. „hello.s”
/* hello.c */
#include<stdio.h> /*Preprocessor directives*/
int main()
{
printf(“Hello Worldn”);
return 0;
}
10. “hello.s” is the input to Assembler
Compiled into object file “hello.o”
/* hello.c */
#include<stdio.h> /*Preprocessor directives*/
int main()
{
printf(“Hello Worldn”);
return 0;
}
11. Final stage
“hello.o” is the input to linker
Form executable a.out
/* hello.c */
#include<stdio.h> /*Preprocessor directives*/
int main()
{
printf(“Hello Worldn”);
return 0;
}
14. Part of Operating system responsible for
loading the program
Allocates program address space
Copies a program into main memory
15. Stands for Executable and Linkable Format
Object file
Executables
Shared libraries
16. Each object file contains
• code section
• data section
• BSS (Block started by Symbol) section
• symbol table
Symbol table contains information of
• global variable,
• external functions like printf, scanf
• Functions defined in other object file
17. not specific to particular processor or
architecture
adopted to many operating systems on many
different platforms
18.
19. Combines code and data sections
Resolves symbols for global variable
Resolves symbols for external function and
library function such as printf, scanf
20. What is Library?
It is a collection of pre-compiled functions and
reusable code.
In Linux, it is called glibc (GNU C library)
23. Link at the compilation stage into the final
executable
Size of the executable becomes large
compared to shared library
Need more RAM
Fast
Suitable for small program
24. It just verifies the link
Actual symbol is added at the time of running
Size of executable become less as compared
to Static
Becomes slower than static library
Used for bigger application
25. C language is
• Efficient
• Powerful
• Flexible
Its being 40 years it is used extensively and
will be used for many more years to come.
Encourage yourself to be a good programmer
to sustain in software industry