[ Pobierz całość w formacie PDF ]
1
“Test everything. Hold on to the good.”
First Chapter
Greetings.
It is a common practice to skip the acknowledgement and book organization. So we have
placed them in the First Chapter! Please read this chapter without fail to understand this book
better.
1.1 Acknowledgement
Throughout the world many people have contributed to this book. We must acknowledge
all those good people. We sincerely thank
Dr. Dennis M. Ritchie
, creator of C language for
granting permission to use his photo. Our thanks also goes to
Dr. Ralf Brown
for providing us
his great source—Ralf Brown’s Interrupt List for this book. We must thank
Mr. Alexander
Russell
for his unconditional support to this book. We are proud to thank all the real and
international programmers who provided their source code to us.
Ms. Lyril Sugitha
(lyrils@yahoo.com) helped us a lot to
translate
this book from
“Tanglish” to English! We sincerely thank her as she worked with us even in her tight schedules.
I specially thank my mother for her prayers for the success of this project and my father
for his support by presenting me a computer. My sincere thanks to my sister Lincy, brother
Bensley and my friend Brighton for their encouragement. I benefited greatly from my uncle
Azariah, who helped me in finding many useful materials. I thank all my friends and relatives
who remembered me in their prayers.
K. Joseph Wesley
I am grateful to all my friends who are interested in me. I remember all my teachers for
their care towards me. I especially thank my Lecturer
Mr. Richard Devaraj
, American College
for his concern towards my career. I must thank
Mr. D. Joseph Devadason
(Lecturer in
Management Studies, American College, joseph_d@rediffmail.com), one of my good and old
friends for helping me to understand English in a better way. Finally, I would like to express
my sincere gratitude to my family members who are behind my development: Papa, Amma, Patti,
Mama, Mami & Akka.
R. Rajesh Jeba Anbiah
1.2 Book Organization
Part I
-
ANSI C
1
2
A to Z of C
Part II
-
DOS Programming
Part III
-
Advanced Graphics Programming
Part IV
-
Advanced Programming
Part V
-
Mathematics & C
Part VI
-
Algorithms & C
Part VII
-
Illegal Codes
Part VIII
-
Next Step
Part IX
-
Smart Dictionary
Part X
-
Postlude
1.3 FAQ about A to Z of C
Q:
What do you mean by FAQ?
A: FAQ is the acronym for Frequently Asked Questions. So when you read FAQ, most of
your questions will be answered!
Q:
Why have you written this book?
A: Because of the dissatisfaction over the existing books on C! Yes. We have lots of books
on C, but most of the books do not cover advanced topics and most of the books are priced
higher. So we have decided to write a non-profit book and to let the secrets open! We could see
many Indian authors who have stolen the works of International Programmers without
acknowledging them. So, in our book, we decided to acknowledge those intelligent people.
(Many authors had thrust different myths & mistakes directly or indirectly in the minds of Indian
C Programmers)
Q:
What is the user level of this book?
A:
Q:
What is the category of this book?
A: Programming. We’ve got so many ways to solve a single problem. And hence this book
also introduces various approaches to solve different problems.
Q:
To whom have you written this book?
A:
Q:
Is this book for students of top level institutions?
A: No. We never think that those people are super human beings. Our doctrine is “If you
can, then I can! If I can, then you can!” This book is for learners.
2
Intermediate to Advanced
C lovers, students, programmers, and other enthusiasts.
A to Z of C
3
Q:
I want to score more marks in University examination. Will this book help me?
A: No. We are dead against the mark-based culture. This book is purely for enthusiasts. This
book is written to open many secrets of C.
Q:
What are the special features of this book?
A: This book is not only written by K. Joseph Wesley & R. Rajesh Jeba Anbiah, but many
renowned International programmers’ and authors’ materials are also used with permission. The
supplement CD
got many sources, and utilities. For more details about CD
, see “
Contents
of CD
”
Q:
How far I can trust source codes of this book?
A: We have tested all the codes. Certain source codes of this book are of real programmers.
We have used their codes according to their terms. So all codes should logically work! But,
obviously there must be some flaws in the approach/solution; the readers are encouraged to find
better—alternate solution.
Q:
Which compiler & IDE you are going to use?
A: We have used TC++3.0. And all parts of this book refer the IDE (Integrated
Development Environment) TC++3.0 unless otherwise noted.
Q:
How should I use this book?
A: Read all the contents of the book first. Then workout examples and exercises. After
gaining confidence, dare to do projects!
1.4 Book Style
The book contains “Note” & “Caution” wherever it is necessary. We thought the word
“We” would confuse the reader whether it refers “authors & reader” or “K. Joseph Wesley &
R.Rajesh Jeba Anbiah (authors)”. So we have decided to use “I” instead of “We” for clarity. And
hereafter the word “I” refers “authors (K. Joseph Wesley & R. Rajesh Jeba Anbiah)” and “We”
refers “authors & reader”.
3
2
“Every good tree produces good fruit.”
Birth of C
C is very often referred as a “System
Programming Language” because it is used for writing
compilers, editors and even operating systems. C was
developed and implemented on the UNIX operating
system on the DEC PDP-11, by Dennis M. Ritchie. C was
evolved during 1971-73 from B language of Ken
Thompson, which was evolved (in 1969-70) from BCPL
language of Martin Richards.
Courtesy: Lucent Technologies
Timeline
Year
Language/OS
Remarks
1956-63
Assembly Language IBM developed Assembly language
1954-57
FORTRAN (FORmula
TRANslation)
A team lead by
John W. Backus
developed a
numerically orientated language called
FORTRAN
An important structured programming
language was developed by committee of
European and American computer scientists
1958
ALGOL(ALGOrithmic
Language)
FORTRAN & ALGOL’s type structures later
influenced many other languages including
BCPL, B & C
1964
PL/I (Programming
Language 1)
IBM developed a clean language intended for
both business and scientific purposes
1965
The famous “Multics project” was started by
MIT, Bell Labs & General Electric as a joint
venture.
Multics
(Multiplexed Information
and Computing Service) is an experimental
Operating System. It was the first operating
system written in a high level language
namely PL/I
TMG
(TransMoGrifiers)
McClure
developed TMG as a language for
writing compilers
4
Dennis M. Ritchie
,
Creator of C Language
A to Z of C
5
Year
Language/OS
Remarks
1967
BCPL (Basic
Combined
Programming
Language)
Martin Richards
wrote BCPL, while he was
visiting MIT
Dennis M. Ritchie joined Bell Labs
Bell Labs pulled out of the Multics project
because of lack of hardware support
1969
PL/I was proved to be inefficient with Multics
project.
Ken Thompson & Dennis M. Ritchie felt that
BCPL was also inefficient, who were using
BCPL in Multics project too.
Unix
Ken Thompson
wrote original Unix system
in PDP-7 assembler
McIlroy and Bob Morris used TMG to write
PL/I compiler for Multics
Challenged by McIlroy's feat in reproducing
TMG,
Ken Thompson
wrote a system
programming language called
B
B is a BCPL squeezed into 8k bytes of
memory.
One theory says that B’s name is derived
from BCPL. But other theory says B’s name is
a contraction of
Bon
, another language
created by Ken Thompson during Multics
days. Bon is thought to be named after
Bonnie, Ken Thompson’s wife.
1969-70
B
B compiler on PDP-7 did not generate
machine code instructions, instead generated
‘threaded code’
1971
NB (New B)
Dennis M. Ritchie
began to rewrite B’s
compiler to generate PDP-11 machine
instructions. He also added character types to
B for brevity. At the early stage he called it
as NB (New B)
1971-73
C
Dennis M. Ritchie
added few more features
to NB and C was born
1973(summer)
AT&T scientists rewrote Unix kernel in C. That
incident added popularity to C
1978
Brian Kernighan & Dennis M. Ritchie wrote
“The C Programming Language”, the first
authoritative book on C. This book is often
nicked as “K&R” or “white book”
1977-1979
C has undergone few more changes when
Unix system’s popularity was demonstrated
5
[ Pobierz całość w formacie PDF ]