UNIT – II
Problem Solving Techniques
with C – S11BLH12
1
, UNIT II C: MATH BEHIND CODING
C: Structure of program – Character set – Tokens – Keywords – Identifiers –
Constants – Variables – Datatypes – Strings – Operators and its types – Functions –
Header Files
Algorithmic Strategies: Iteration and Recursion – Efficiency – Role of Time and Space
consumption while building an algorithm – Complexities
1. Introduction to C
C programming is a general-purpose, procedural programming language developed in
1972 by Dennis M. Ritchie at the Bell Telephone Laboratories to develop the UNIX
operating system. It is machine-independent, structured programming language which is
used extensively in various applications. Many later languages have borrowed
syntax/features directly or indirectly from C language. Like syntax of Java, PHP, JavaScript,
and many other languages are mainly based on C language. C++ is nearly a superset of C
language (There are few programs that may compile in C, but not in C++).
1.1 History of C language
The root of all modern languages is 'ALGOL.' It was first introduced in 1960. 'ALGOL'
introduced the concept of structured programming to the developer community. In 1967, a
new computer programming language was announced called as 'BCPL' which stands for
Basic Combined Programming Language. BCPL was designed and developed by Martin
Richards, especially for writing system software. This was the era of programming
languages. Just after three years, in 1970 a new programming language called 'B' was
introduced by Ken Thompson that contained multiple features of 'BCPL.' This programming
language was created using UNIX operating system at AT&T and Bell Laboratories. Both
the 'BCPL' and 'B' were system programming languages.
2
, Fig. 1 History of C language
In 1972, a great computer scientist Dennis Ritchie created a new programming language
called 'C' at the Bell Laboratories. It was created from 'ALGOL', 'BCPL' and 'B' programming
languages. 'C' programming language contains all the features of these languages and many more
additional concepts that make it unique from other languages.
American National Standards Institute (ANSI) defined a commercial standard for 'C'
language in 1989. Later, it was approved by the International Standards Organization (ISO) in
1990. 'C' programming language is also called as 'ANSI C'. The standardization committee of C
added a few features of C++/Java to enhance the usefulness of the language. The result was the
1999 standard for C. This version is usually referred to as C99. The history and development of
C is illustrated in Fig. 1.
3
, 1.2 Where is C used? Key Applications
'C' language is widely used in embedded systems.
It is used for developing system applications.
It is widely used for developing desktop applications.
Most of the applications by Adobe are developed using 'C' programming language.
It is used for developing browsers and their extensions. Google's Chromium is built using
'C' programming language.
It is used to develop databases. MySQL is the most popular database software which is
built using 'C'.
It is used in developing an operating system. Operating systems such as Apple's OS X,
Microsoft's Windows, and Symbian are developed using 'C' language. It is used for
developing desktop as well as mobile phone's operating system.
It is used for compiler production.
It is widely used in Internet of Things (IOT) applications.
2. Features of C
C is the widely used language. It provides many features that are illustrated in fig.2.
Fig 2. Features of C
4
Problem Solving Techniques
with C – S11BLH12
1
, UNIT II C: MATH BEHIND CODING
C: Structure of program – Character set – Tokens – Keywords – Identifiers –
Constants – Variables – Datatypes – Strings – Operators and its types – Functions –
Header Files
Algorithmic Strategies: Iteration and Recursion – Efficiency – Role of Time and Space
consumption while building an algorithm – Complexities
1. Introduction to C
C programming is a general-purpose, procedural programming language developed in
1972 by Dennis M. Ritchie at the Bell Telephone Laboratories to develop the UNIX
operating system. It is machine-independent, structured programming language which is
used extensively in various applications. Many later languages have borrowed
syntax/features directly or indirectly from C language. Like syntax of Java, PHP, JavaScript,
and many other languages are mainly based on C language. C++ is nearly a superset of C
language (There are few programs that may compile in C, but not in C++).
1.1 History of C language
The root of all modern languages is 'ALGOL.' It was first introduced in 1960. 'ALGOL'
introduced the concept of structured programming to the developer community. In 1967, a
new computer programming language was announced called as 'BCPL' which stands for
Basic Combined Programming Language. BCPL was designed and developed by Martin
Richards, especially for writing system software. This was the era of programming
languages. Just after three years, in 1970 a new programming language called 'B' was
introduced by Ken Thompson that contained multiple features of 'BCPL.' This programming
language was created using UNIX operating system at AT&T and Bell Laboratories. Both
the 'BCPL' and 'B' were system programming languages.
2
, Fig. 1 History of C language
In 1972, a great computer scientist Dennis Ritchie created a new programming language
called 'C' at the Bell Laboratories. It was created from 'ALGOL', 'BCPL' and 'B' programming
languages. 'C' programming language contains all the features of these languages and many more
additional concepts that make it unique from other languages.
American National Standards Institute (ANSI) defined a commercial standard for 'C'
language in 1989. Later, it was approved by the International Standards Organization (ISO) in
1990. 'C' programming language is also called as 'ANSI C'. The standardization committee of C
added a few features of C++/Java to enhance the usefulness of the language. The result was the
1999 standard for C. This version is usually referred to as C99. The history and development of
C is illustrated in Fig. 1.
3
, 1.2 Where is C used? Key Applications
'C' language is widely used in embedded systems.
It is used for developing system applications.
It is widely used for developing desktop applications.
Most of the applications by Adobe are developed using 'C' programming language.
It is used for developing browsers and their extensions. Google's Chromium is built using
'C' programming language.
It is used to develop databases. MySQL is the most popular database software which is
built using 'C'.
It is used in developing an operating system. Operating systems such as Apple's OS X,
Microsoft's Windows, and Symbian are developed using 'C' language. It is used for
developing desktop as well as mobile phone's operating system.
It is used for compiler production.
It is widely used in Internet of Things (IOT) applications.
2. Features of C
C is the widely used language. It provides many features that are illustrated in fig.2.
Fig 2. Features of C
4