Let Us C
Fifth Edition
Yashavant P. Kanetkar
, Dedicated to baba
Who couldn’t be here to see this day...
,About the Author
Destiny drew Yashavant Kanetkar towards computers when the IT
industry was just making a beginning in India. Having completed
his education from VJTI Mumbai and IIT Kanpur in Mechanical
Engineering he started his training company in Nagpur.
Yashavant has a passion for writing and is an author of several
books in C, C++, VC++, C#, .NET, DirectX and COM
programming. He is a much sought after speaker on various
technology subjects and is a regular columnist for Express
Computers and Developer 2.0. His current affiliations include
being a Director of KICIT, a training company and DCube
Software Technologies, a software development company. In
recognition to his contribution Microsoft awarded him the
prestigious “Best .NET Technical Contributor” award recently.
He can be reached at .
, Preface to the Fifth Edition
It is mid 2004. World has left behind the DOTCOM bust, 9/11
tragedy, the economic downturn, etc. and moved on. Countless
Indians have relentlessly worked for close to two decades to
successfully establish “India” as a software brand. At times I take
secret pleasure in seeing that a book that I have been part of, has
contributed in its own little way in shaping so many budding
careers that have made the “India” brand acceptable.
Computing and the way people use C for doing it keeps changing
as years go by. So overwhelming has been the response to all the
previous editions of “Let Us C” that I have now decided that each
year I would come up with a new edition of it so that I can keep
the readers abreast with the way C is being used at that point in
time.
There are two phases in every C programmer’s life. In the first
phase he is a learner trying to understand the language elements
and their nuances. At this stage he wants a simple learning
environment that helps him to master the language. In my opinion,
even today there isn’t any learning environment that can beat
Turbo C/C++ for simplicity. Hence the first fifteen chapters are
written keeping this environment in mind, though a majority of
these programs in these chapters would work with any C compiler.
Armed with the knowledge of language elements the C
programmer enters the second phase. Here he wishes to use all that
he has learnt to create programs that match the ability of programs
that he see in today’s world. I am pointing towards programs in
Windows and Linux world. Chapters 16 to 21 are devoted to this. I
would like to your attention the fact that if you want to program
Windows or Linux you need to have a very good grasp over the
programming model used by each of these OS. Windows
messaging architecture and Linux signaling mechanism are the
cases in point. Once you understand these thoroughly rest is just a
vi
Fifth Edition
Yashavant P. Kanetkar
, Dedicated to baba
Who couldn’t be here to see this day...
,About the Author
Destiny drew Yashavant Kanetkar towards computers when the IT
industry was just making a beginning in India. Having completed
his education from VJTI Mumbai and IIT Kanpur in Mechanical
Engineering he started his training company in Nagpur.
Yashavant has a passion for writing and is an author of several
books in C, C++, VC++, C#, .NET, DirectX and COM
programming. He is a much sought after speaker on various
technology subjects and is a regular columnist for Express
Computers and Developer 2.0. His current affiliations include
being a Director of KICIT, a training company and DCube
Software Technologies, a software development company. In
recognition to his contribution Microsoft awarded him the
prestigious “Best .NET Technical Contributor” award recently.
He can be reached at .
, Preface to the Fifth Edition
It is mid 2004. World has left behind the DOTCOM bust, 9/11
tragedy, the economic downturn, etc. and moved on. Countless
Indians have relentlessly worked for close to two decades to
successfully establish “India” as a software brand. At times I take
secret pleasure in seeing that a book that I have been part of, has
contributed in its own little way in shaping so many budding
careers that have made the “India” brand acceptable.
Computing and the way people use C for doing it keeps changing
as years go by. So overwhelming has been the response to all the
previous editions of “Let Us C” that I have now decided that each
year I would come up with a new edition of it so that I can keep
the readers abreast with the way C is being used at that point in
time.
There are two phases in every C programmer’s life. In the first
phase he is a learner trying to understand the language elements
and their nuances. At this stage he wants a simple learning
environment that helps him to master the language. In my opinion,
even today there isn’t any learning environment that can beat
Turbo C/C++ for simplicity. Hence the first fifteen chapters are
written keeping this environment in mind, though a majority of
these programs in these chapters would work with any C compiler.
Armed with the knowledge of language elements the C
programmer enters the second phase. Here he wishes to use all that
he has learnt to create programs that match the ability of programs
that he see in today’s world. I am pointing towards programs in
Windows and Linux world. Chapters 16 to 21 are devoted to this. I
would like to your attention the fact that if you want to program
Windows or Linux you need to have a very good grasp over the
programming model used by each of these OS. Windows
messaging architecture and Linux signaling mechanism are the
cases in point. Once you understand these thoroughly rest is just a
vi