Introduction To C Programming
Introduction To C Programming
Module I
Topic – Introduction to C
23ADT001 - C PROGRAMMING
Introduction to C Programming
• The father of programming languages is ALGOL. It came in the year 1960.
With the help of ALGOL, the developer community learned about the concept
of structured programming language.
• In the year of 1967, a new programming language named BCPL was
introduced. BCPL stands for Basic Combined Programming Language. It is
specially used for writing system software.
• In 1972, a great computer scientist named Dennis Ritchie created the C
programming language. It includes all the features of B, BCPL, ALGOL, and
many more additional features too.
23ADT001 - C PROGRAMMING
Introduction to C Programming
23ADT001 - C PROGRAMMING
History of C
23ADT001 - C PROGRAMMING
key features or characteristics of C language:
23ADT001 - C PROGRAMMING
key features or characteristics of C language:
• is a very flexible
• is fast
• is modular, i.e. can be divided into small modules
• is easily available
• is easy to debug, as it detects syntax errors quickly and
easily and displays the errors along with the line numbers
of the code and the error message
23ADT001 - C PROGRAMMING
C Basic commands Explanation
printf(“Hello_World!
printf command prints the output onto the screen.
“);
This command waits for any character input from
getch(); keyboard.
This command terminates C program (main
return 0; function) and returns 0.
23ADT001 - C PROGRAMMING
Compilers and Interpreters
23ADT001 - C PROGRAMMING
Compiler
Source Target
Program Compiler Program Debug on X
Compile on X
Target Output
Input
Program
Run on X
23ADT001 - C PROGRAMMING
Interpreter
Interpreter process
Source
program
Interpreter Output
Input
23ADT001 - C PROGRAMMING
Comparison b/w compiler and Interpreter
S.No Compiler Interpreter
.
4
Overall execution time of code Overall execution time of a
is faster code is slower
23ADT001 - C PROGRAMMING
Compilation & Linking Process
23ADT001 - C PROGRAMMING
Execution Flow
23ADT001 - C PROGRAMMING
Execution Flow
Let's try to understand the flow of above program by the figure given below.
1) C program (source code) is sent to preprocessor first. The preprocessor is responsible
to convert preprocessor directives into their respective values. The preprocessor
generates an expanded source code.
2) Expanded source code is sent to compiler which compiles the code and converts it into
assembly code.
3) The assembly code is sent to assembler which assembles the code and converts it into
object code. Now a simple.obj file is generated.
4) The object code is sent to linker which links it to the library such as header files. Then it
is converted into executable code. A simple.exe file is generated.
5) The executable code is sent to loader which loads it into memory and then it is
executed. After execution, output is sent to console.
23ADT001 - C PROGRAMMING
Working with C
• Windows - OS
• Visual C++ 2008 Express Edition
• Turbo C++
• wxDev-C++
• Linux and Unix - OS
• GNU Gcc
23ADT001 - C PROGRAMMING
Turbo C++
• Open a new file from File > New in the
Turbo C++ IDE.
• Write a small program in the IDE.
• Now go to File > Save As and save the
program with the filename of your choice
(make sure extension of the filename is .c).
• Now go to compile and click on Compile.
And then Click on Run.
• You will see the output of your C program.
23ADT001 - C PROGRAMMING
References
• Ashok N.Kamthane, Amit.N.Kamthane, “Programming in C”, 3 rd
Edition, Pearson Education, 2015
• Ajay Mittal, “Programming in C-A Practical Approach”, 3 rd Edition,
Pearson Education, 2010.
• Yashavant P.Kanetkar, “Let Us C”, 16th Edition, BPB Publications,
2018.
• PradipDey, ManasGhosh, “Computer Fundamentals and
Programming in C”, 2nd Edition, Oxford University Press, 2013.
23ADT001 - C PROGRAMMING
23ADT001 - C PROGRAMMING