Sie sind auf Seite 1von 9

HISTORY OF C

Overview of C
No Topic
1 Features of C Language
2 Application of C Programming
3 Compiler
4 Compiler Phases : Phase 1 | 2 | 3 | 4 | 5 | 6
5 Interpreter
6 Compiler Vs Interpreter
7 Execution of C Program
8 Type of Languages :

Low Level Language

Middle Level Language

High Level Language
9 What is Comment in C ?
10 Types of Comment : Single Line | Multi Line
11 Difference Between Single and Multi Line Comment
12 Data types
History of C Programming Language
1. C is a programming language which born at AT & Ts Bell Laboratory of
USA in 1972.
2. C was written by Dennis Ritchie, thats why he is also called as father of c
programming language.
3. C language was created for a specific purpose i.e designing the UNIX operating
system (which is currently base of many UNIX based OS).
Why Name C was given to Language ?
1. Many of Cs principles and ideas were derived from the earlier language B. (Ken
Thompson was the developer of B Language.)
2. BCPL and CPL are the earlier ancestors of B Language
3. CPL is common Programming Language.In 1967, BCPL Language ( Basic CPL )
was created as a scaled down version of CPL
4. As many of the features were derived from B Language thats why it was
named as C.
5. After 7-8 years C++ came into existence which was first example of object
oriented programming .
Summary of C Programming Language History
Summary
1 B Language Developed By Ken Thompson
2 Operating System Developed in C UNIX
3 Developed at AT & T Bell Laboratory
4 Creator of Traditional C Dennis Ritchie
5 Year 1972
C Programming Language Timeline :
Programming Language Development Year Developed by
ALGOL 1960 International Group
BCPL 1967 Martin Richards
B 1970 Ken Thompson
Traditional C 1972 Dennis Ritchie
K&R C 1978 Brain Kernighan and Dennis Ritchie
ANSI C 1989 ANSI Committee
ANSI/ISO C 1990 ISO Committee

Features of C Programming Language :
C Programming is widely used in Computer Technology, We can say that C is
inspiration for development of other languages. We can use C for different purposes.
Below are some of the Features of C Programming -
Features of C

Low Level Language Support Program Portability
Powerful and Feature Rich Bit Manipulation
High Level Features Modular Programming
Efficient Use of Pointers

1 . Low Level Features :
1. C Programming provides low level features that are generally provided by the
Lower level languages. C is Closely Related to Lower level Language such as
Assembly Language.
2. It is easier to write assembly language codes in C programming.
2 . Portability :
1. C Programs are portable i.e they can be run on any Compiler with Little or no
Modification
2. Compiler and Preprocessor make it Possible for C Program to run it on
Different PC
3 . Powerful
1. Provides Wide verity of Data Types
2. Provides Wide verity of Functions
3. Provides useful Control & Loop Control Statements
4 . Bit Manipulation
1. C Programs can be manipulated using bits. We can perform different operations
at bit level. We can manage memry representation at bit level. [Eg. We can use
Structure to manage Memory at Bit Level]
2. It provides wide verity of bit manipulation Operators. We have bitwise operators
to manage Data at bit level.
5 . High Level Features :
1. It is more User friendly as compare to Previous languages. Previous languages
such as BCPL,Pascal and other programming languages never provide such
great features to manage data.
2. Previous languages have there pros and cons but C Programming collected all
useful features of previous languages thus C become more effective language.
6 . Modular Programming
1. Modular programming is a software design technique that increases the extent to
which software is composed of separate parts, called modules
2. C Program Consist of Different Modules that are integrated together to form
complete program
7 . Efficient Use of Pointers
1. Pointers has direct access to memory.
2. C Supports efficient use of pointer .
8 . More Efficient
Application Of C Programming
C Programming is best known programming language. C Programming is near to
machine as well as human so it is called as Middle level Programming Language. C
Programming can be used to do verity of tasks such as networking related,OS related.
Application of C Programming are listed below -
1. C language is used for creating computer applications
2. Used in writing Embedded softwares
3. Firmware for various electronics, industrial and communications products which use
micro-controllers.
4. It is also used in developing verification software, test code, simulators etc. for various
applications and hardware products.
5. For Creating Compiles of different Languages which can take input from other language
and convert it into lower level machine dependent language.
6. C is used to implement different Operating System Operations.
7. UNIX kernel is completely developed in C Language.
List of Applications of C Programming
List of Application

Operating Systems Network Drivers Print Spoolers
Language Compilers Assemblers Text Editors
Modern Programs Data Bases Language Interpreters
Simulators Utilities Embedded System

Definition of Compiler :
1. A computer program which reads source code and outputs assembly code or executable
code is called compiler.
2. A program that translates software written in source code into instructions that a
computer can understand Software used to translate the text that a programmer writes
into a format the CPU can use.
3. A piece of software that takes third-generation language code and translates it into a
specific assembly code. Compilers can be quite complicated pieces of software.i

Difference between Compiler and Interpreter
No Compiler Interpreter
1
Compiler Takes Entire program as
input
Interpreter Takes Single instruction as
input .
2 Intermediate Object Code is Generated No Intermediate Object Code is Generated
3
Conditional Control Statements are
Executes faster
Conditional Control Statements are
Executes slower
4
Memory Requirement : More (Since
Object Code is Generated)
Memory Requirement is Less
5 Program need not be compiled every Every time higher level program is
time converted into lower level program
6
Errors are displayed after entire
program is checked
Errors are displayed for every instruction
interpreted (if any)
7 Example : C Compiler Example : BASIC
What is Low level Language in Computer Science ?
Machine understandable Language.
Assembly is Common High Level Language
Internal Machine Code dependent
Fast to Run But slow to write & Understand

What is machine Level Language ?
1. Machine code is the only language a microprocessor can process directly without
a previous transformation.
2. Currently, Programmers never write programs directly in machine code,
because it requires attention to numerous details which a high-level language
would handle automatically.
3. Low Level Language Requires memorizing or looking up numerical codes for
every instruction that is used.
4. For this reason, second generation programming languages provide one
abstraction level on top of the machine code.
Middle Level Language ?
C Programming bridges gap between traditional Machine Understandable Machine
Level language and more conventional High level languages. User can Use C Language
to do system programming for writing operating system as well as application
programming.
Middle Level Programming languages are closely related to Machine as well as Human
Being.
Why C is Middle Level Language ?
1. C Programming Supports Inline Assembly Language Programs .
2. Using inline assembly language feature in C we can directly access system
registers.
3. C Programming is used to access memory directly using pointer.
4. C Programming also Supports high Level Language Features.
5. It is more User friendly as compare to Previous languages so C programming is
Middle Level Language.

Single Line Comment
Comments are non-executable code used to provide documentation to programmer.
Which Part is Ignored by Compiler ? [Shown by Asterisk]
#include<stdio.h>
void main()
{
printf("Hello"); // ********** Until Line Ends *****
printf("By");
}
Different Ways of Writing Singular Line Comment :
For Specifying Operation
#include<stdio.h>
int main()
{
int cvar=1,dvar=2; // Declare Variables
int sum = 0; // Declare Sum
sum = cvar + dvar; // Compute Sum
printf("Sum : %d",sum);
return(0);
}


Multi Line Comment
Multi Line Comment Can be Placed Anywhere.
Multi Line Comment Starts with /* .
Multi Line Comment Ends with */ .
Any Symbols written between /* and */ are ignored by Compiler.
It can be split over multiple Lines
Example :
#include<stdio.h>
void main()
{
printf("Hello");
/* Multi
Line
Comment
*/
printf("By");
Difference Between Single Line and Multi line Comment ?
Multi-line Comment Single-line Comments
Starts with /* and ends with */ Starts with //
All Words and Statements written between
/* and */ are ignored
Statements after the symbol // upto the end
of line are ignored
Comment ends when */ Occures
Comment Ends whenever ENTER is
Pressed and New Line Starts
e.g /* This is Multiline Comment */ e.g // Single line Comment
What is Data Type in C Programming ?
1. A Data Type is a Type of Data.
2. Data Type is a Data Storage Format that can contain a Specific Type or Range of
Values.
3. When computer programs store data in variables, each variable must be assigned a
specific data type.
Some of the Data Types Supported by C :
Data Type keyword Description
Integer Data Type int Stores the Integer Value
Float Data Type float Stores the Floating Point Value
Character Data Type char Stores the Single Character Value
Long Data Type long Stores the Long range Integer Value
Double Data Type double Stores the long range Floating Value
Explanation :
1. Whenever we declare variable in Computers memory, Computer must know the type
of the data to be stored inside the memory.
2. If we need to store the single character then the size of memory occupied will be
different than storing the single integer number.
3. The memory in our computers is organized in bytes. A byte is the minimum amount
of memory that we can manage in C.
4. A byte can store a relatively small amount of data one single character or a small
integer (generally an integer between 0 and 255).
Size Required to Store Variable of Different Data Types
Data Type Borland C/C++ Compiler
Integer 2 Bytes
Float 4 Bytes
Character 1 Byte
Long 4 Byte
Whenever we create a structure then we are treated it as new type of data. In C programming
a keyword called typedef gives you facility to rename data type.
Consider the following example Suppose we are storing only roll numbers then it would be
very useful and meaningful if we have data type roll.
Defining Type in C using typedef :
#include<stdio.h>

void main()
{
typedef int Roll;
Roll num1 = 40,num2 = 20;

printf("Roll number 1 : %d",num1);
printf("Roll number 2 : %d",num2);
}
Integer Data Type : About Short Integer & Long Integer
1. Integers are whole numbers with a wide range of values that are machine dependent.
2. Integer occupies 2 bytes memory space and its value range limited to -32768 to +32767

How this range is Calculated ?
Size of Integer = 2 bytes
No of Bits = 16 bits
= MSB bit is considered as Sign Bit
(Skip that bit)
= 16 bits - 1 bit
= 15 bits
Maximum Range of Integer
Max Range = 2 Raise to 15
= 32768
Minimum Range of Integer
Min Range = 2 Raise to -15
= -32768
Types of Integer Data Types :
1. Integer
2. Short Integer
3. Long Integer
Some Important Points :
Range of Integer is [2^-15 to 2^+15]
Each type is again classified into signed and unsigned integer.
Unsigned integer dont have sign bit , so its range is 0 to 65535
A short int requires half the amount of storage than normal integer.
Unlike signed integer, unsigned integers are always positive and use all the bits for the
magnitude of the number. Therefore the range of an unsigned integer will be from 0 to
65535.
The long integers are used to declare a longer range of values and it occupies 4 bytes of
storage space.

Syntax of Declaring Integer
int num1;
short int num2;
long int num3;
Example of Integer Data types
500
6764
32100
32766