3. Introduction
What is C language ?
C is a high-level and general purpose programming
language that is ideal for developing firmware or
portable applications. Originally intended for writing
system software, C was developed at Bell Labs by
Dennis Ritchie for the Unix Operating System (OS) in
the early 1970s.
4. of C language -
Simple
Portability
Powerful
Case sensitive
Modularity
Use of Pointers
5. History of C language
Its early developments -
C language was invented for implementing
UNIX operating system.
The C programming language is a structure
oriented programming language,
developed at Bell Laboratories in 1972 by
Dennis Ritchie.
C programming language features were
derived from an earlier language called
“B” (Basic Combined Programming
Language – BCPL).
Ken Thompson & Dennis Ritchie
6. K&R C -
In 1978, Brian Kernighan and Dennis Ritchie published the
first edition of ”The C Programming Language”. This
book, known to C programmers as "K&R", served for many
years as an informal specification of the language.
K&R introduced several language features:
Standard I/O library
Long int data type
Unsigned int data type
In the years following the publication of K&R C, several
features were added to the language, supported by
compilers from AT&T and some other vendors. These
included:
Void functions
Assignment for struct data types
Enumerated types
Functions returning struct or union types
7. C Language Standards -
• C89/C90 standard –
First standardized specification for C language was developed
by the American National Standards Institute in 1989. C89 and
C90 standards refer to the same programming language.
• C99 standard –
Next revision was published in 1999 that introduced new
features like advanced data types and other changes.
8. C11 AND EMBEDDED C LANGUAGE –
• C11 standard adds new features to C programming language
and library like type generic macros, anonymous structures,
improved Unicode support, atomic operations, multi-
threading and bounds-checked functions. It also makes some
portions of the existing C99 library optional and improves
compatibility with C++.
• Embedded C includes features not available in C like fixed-
point arithmetic, named address spaces, and basic I/O
hardware addressing.
• Operating systems, C compiler and all UNIX application
programs are written in C language
• It is also called as procedure oriented programming language.
The C language is reliable, simple and easy to use. C has been
coded in assembly language.
9. Myths & Secrets
“ C is quirky, flawed, and an enormous success.”
- Dennis Ritchie
10. 1) C is obsolete.
No one uses C anymore!
It is true that C is the Latin of programming
languages and that recent languages are more
flexible and let us do amazing stuff with ease.
However, most of these languages have emerged
from C. They have been built with C as their base.
11. 2) C++ is better than C.
There are two versions of everything these days,
exactly like C and C++. C is like the 5-inch version
of a smartphone and C++ is its 6-inch variant. Both
pack almost same features with a few
modifications here and there. Whatever you
achieve with C, you can achieve with C++.
Similarly, whatever you can make in C++, you can
also make that with C.
12. 3) C++ is the next version of C!
People say C++ is the next version of C, which
technically it is NOT, not even close! The term
“version” comes into picture when we are dealing
with the same thing, for example, Windows 8,
Windows 8.1 and so on. In the case of C and C++,
they are two different languages. It’s true that
they are built on the same base, but they can’t
technically be called “versions” as such.
13. 4) Arrays start at 0 rather than 1.
Most people start counting at 1, rather than zero. Compiler writers
start with zero because we're used to thinking in terms of offsets.
This is sometimes tough on non-compiler-writers; although a[100]
appears in the definition of an array, we would better not store any
data at a[100], since a[0] to a[99] is the extent of the array.
5) No nested functions.
Function contained inside another function is known
as nested function. This simplifies the
compiler and slightly speeds up the runtime
organization of C programs.
14. Experiments
1) Difference in data types sizes in GCC and in Turbo
compiler.
Here is the code -
#include<stdio.h>
int main()
{
int *p;
printf("%dn", sizeof(int));
printf("%dn", sizeof(char));
printf("%dn", sizeof(float));
printf("%dn", sizeof(double));
printf("%dn", sizeof(p));
return 0;
}
15. After Compiling the above code,
Here is the output -
GCC Compiler Turbo C Compiler
16. 2. Difference in output in Increment Decrement operator.
Here is the code -
#include<stdio.h>
int main()
{
int i=5;
printf("%d%d%d%d%d",i++,i--,++i,--i,i);
return 0;
}
17. After Compiling the above code,
Here is the output -
GCC Compiler Turbo C Compiler