Page Tools:

Let Us C, Eighth Edition

Author(s): Yashavant P. Kanetkar
Details:
  • ISBN-13: 9781934015254
  • Paperback    593 pages      © 2008
Price: $236.95 US List
Add to Cart

Considered to be one of the best-selling programming books ever written, the Eighth Edition has now been edited, revised, and updated. Simplicity and an easy narration style are the hallmarks of the book, which have made its previous seven editions immensely successful. Today’s C programmer (still the language of choice in science, engineering, game programming and for handheld devices) has to master the complexities of the language and contend with its usage in environments like Windows, Linux, and for the Internet. Let Us C, Eighth Edition covers these three aspects of C programming and doesn’t assume any programming background. It begins with the basics and steadily builds the pace, so the reader finds it easy to handle more complicated topics later. This popular author has crafted hundreds of excellent programming examples and exercises for every aspect of C programming.

Features & Benefits

Self-study format provides hundreds of step by step examples and exercises. 

Assumes no programming knowledge; starts with the basics and progresses to more difficult topics. 

Includes a CD-ROM with demos, code, compiler, executables, and MATLAB examples. 

Covers the latest programming techniques for Windows, Linux, and the Internet. 

Chapter 1. Getting Started 1
What is C? 2
Getting Started with C 4
The C Character Set 4
Constants, Variables, and Keywords 4
Types of C Constants 5
Rules for Constructing Integer Constants 6
Rules for Constructing Real Constants 6
Rules for Constructing Character Constants 7
Types of C Variables 8
Rules for Constructing Variable Names 8
C Keywords 9
The First C Program 10
Compilation and Execution 14
Receiving Input 15
C Instructions 17
Type Declaration Instruction 17
Arithmetic Instruction 18
Integer and Float Conversions 21
Type Conversion in Assignments 22
Hierarchy of Operations 23
Associativity of Operators 25
Control Instructions in C 27
Summary 28
Exercises 28


Chapter 2. The Decision Control Structure 37
Decisions! Decisions! 38
The if Statement 38
The Real Thing 42
Multiple Statements within if 43
The if-else Statement 43
Nested if -elses 46
Forms of if 47
Use of Logical Operators 48
The else-if Clause 50
The ! Operator 55
Hierarchy of Operators Revisited 55
A Word of Caution 56
The Conditional Operators 58
Summary 59
Exercises 60


Chapter 3. The Loop Control Structure 75
Loops 76
The while Loop 76
Tips and Traps 78
More Operators 82
The for Loop 83
Nesting of Loops 88
Multiple Initializations in the for Loop 89
The odd Loop 89
The break Statement 91
The continue Statement 93
The do-while Loops 94
Summary 95
Exercises 96


Chapter 4. The Case Control Structure 105
Decisions Using switch 106
The Tips and Traps 108
switch versus if-else Ladder 113
The goto Keyword 113
Summary 116
Exercises 116

Chapter 5. Functions and Pointers 121
What is a Function? 122
Why Use Functions? 128
Passing Values between Functions 128
Scope Rule of Functions 132
Calling Convention 133
One Dicey Issue 134
Advanced Features of Functions 135
Return Type of Function 135
Call by Value and Call by Reference 136
An Introduction to Pointers 137
Pointer Notation 137
Back to Function Calls 142
Conclusions 144
Recursion 145
Recursion and Stack 148
Adding Functions to the Library 151
Summary 153
Exercises 154

Chapter 6. Data Types Revisited 165
Integers, long and short 166
Integers, signed and unsigned 168
Chars, signed and unsigned 168
Floats and Doubles 170
A Few More Issues . . . 171
Storage Classes in C 173
Automatic Storage Class 174
Register Storage Class 176
Static Storage Class 176
External Storage Class 179
A Few Subtle Issues 181
Which to Use When 182
Summary 183
Exercises 184

Chapter 7. The C Preprocessor 191
Features of the C Preprocessor 192
Macro Expansion 192
Macros with Arguments 196
Macros versus Functions 199
File Inclusion 200
Conditional Compilation 201
#if and #elif Directives 204
Miscellaneous Directives 205
#undef Directive 205
#pragma Directive 205
The Build Process 208
Preprocessing 208
Compilation 209
Assembling 210
Linking 211
Loading 212
Summary 213
Exercises 213

Chapter 8. Arrays 217
What are Arrays? 218
A Simple Program Using Arrays 219
More on Arrays 221
Array Initialization 221
Bounds Checking 222
Passing Array Elements to a Function 223
Pointers and Arrays 225
Passing an Entire Array to a Function 230
The Real Thing 231
Two-Dimensional Arrays 232
Initializing a Two-Dimensional Array 234
Memory Map of a Two-Dimensional Array 234
Pointers and Two-Dimensional Arrays 235
Pointer to an Array 237
Passing a 2D Array to a Function 238
Array of Pointers 241
Three-Dimensional Array 242
Summary 244
Exercises 244

Chapter 9. Puppetting on Strings 263
What are Strings? 264
More about Strings 265
Pointers and Strings 269
Standard Library String Functions 269
strlen( ) 270
strcpy( ) 272
strcat( ) 275
strcmp( ) 275
Two-Dimensional Array of Characters 276
Array of Pointers to strings 278
Limitations of Array of Pointers to Strings 281
Solution 282
Summary 283
Exercises 283

Chapter 10. Structures 289
Why Use Structures? 290
Declaring a Structure 292
Accessing Structure Elements 294
How Structure Elements are Stored 295
Array of Structures 296
Additional Features of Structures 298
Uses of Structures 305
Summary 306
Exercises 306

Chapter 11. Console Input/Output 313
Types of I/O 314
Console I/O Functions 315
Formatted Console I/O Functions 315
sprintf( ) and sscanf( ) Functions 322
Unformatted Console I/O Functions 323
Summary 326
Exercises 326

Chapter 12. File Input/Output 331
Data Organization 332
File Operations 332
Opening a File 333
Reading from a File 335
Trouble Opening a File 335
Closing the File 336
Counting Characters, Tabs, Spaces, . . . 337
A File-Copy Program 338
Writing to a File 339
File Opening Modes 339
String (Line) I/O in Files 340
The Awkward Newline 342
Record I/O in Files 343
Text Files and Binary Files 346
Record I/O Revisited 348
Database Management 351
Low-Level Disk I/O 356
A Low-Level File-Copy Program 356
I/O Under Windows 360
Summary 360
Exercises 361

Chapter 13. More Issues In Input/Output 371
Using argc and argv 372
Detecting Errors in Reading/Writing 375
Standard I/O Devices 376
I/O Redirection 377
Redirecting the Output 378
Redirecting the Input 380
Both Ways at Once 380
Summary 381
Exercises 381

Chapter 14. Operation on Bits 383
Bitwise Operators 384
One’s Complement Operator 385
Right-Shift Operator 387
Left-Shift Operator 389
Bitwise AND Operator 392
Bitwise OR Operator 395
Bitwise XOR Operator 396
The showbits( ) Function 397
Hexadecimal Numbering System 398
Relation between Binary and Hex 399
Summary 400
Exercises 401

Chapter 15. Miscellaneous Features 405
Enumerated Data Type 406
Uses of Enumerated Data Type 407
Are Enums Necessary? 409
Renaming Data Types with typedef 409
Typecasting 411
Bit Fields 412
Pointers to Functions 414
Functions Returning Pointers 416
Functions with a Variable Number of Arguments 417
Unions 421
Union of Structures 425
Utility of Unions 426
The volatile Qualifier 427
Summary 428
Exercises 428

Chapter 16. C Under Windows 433
Which Windows . . . 434
Salient Features of Windows Programming 435
Powerful API Functions 435
Sharing of Functions 435
Consistent Look and Feel 436
Hardware-Independent Programming 436
Event-Driven Programming Model 437
Obvious Programming Differences 438
Integers 439
Heavy Use of typedef 439
Size of Pointers 441
The First Windows Program 441
Hungarian Notation 445
The Role of the Message Box 445
Here Comes the Window . . . 446
More Windows 449
A Real-World Window 449
Creation and Displaying of a Window 451
Interaction with Windows 452
Reacting to Messages 453
Program Instances 455
Summary 455
Exercises 456

Chapter 17. Graphics Under Windows 459
Graphics as of Now 460
Device-Independent Drawing 460
Hello Windows 461
Drawing Shapes 465
Types of Pens 467
Types of Brushes 469
Code and Resources 472
Freehand Drawing, the Paintbrush Style 472
Capturing the Mouse 476
Device Context, a Closer Look 476
Displaying a Bitmap 477
Animation at Work 480
WM_CREATE and OnCreate( ) 483
WM_TIMER and OnTimer( ) 484
A Few More Points . . . 484
Windows, the Endless World . . . 485
Summary 486
Exercises 486

Chapter 18. Internet Programming 489
Network Communication 490
Packets and Sockets 491
Before We Start . . . 492
Protocols 492
IP Addresses 493
Port Numbers 493
Byte Ordering 494
Getting Started . . . 495
What’s the Time Now 497
Creation of a Socket 500
Sending Data to a Time Server 501
Receiving Date and Time 502
Communicating with the Whois Server 502
Give Me the Home Page 505
Sending and Receiving Emails 507
Two-Way Communication 516
Summary 523
Exercises 523

Chapter 19. C Under Linux 525
What is Linux? 526
C Programming Under Linux 527
The ‘Hello Linux’ Program 527
Processes 529
Parent and Child Processes 530
More Processes 533
Zombies and Orphans 534
One Interesting Fact 536
Summary 536
Exercises 537

Chapter 20. More Linux Programming 539
Communication Using Signals 540
Handling Multiple Signals 542
Registering a Common Handler 544
Blocking Signals 545
Event-Driven Programming 547
Where Do You Go from Here 552
Summary 552
Exercises 553

Appendix A. Precedence Table 555
Appendix B. Library Functions 557
Appendix C. Chasing the Bugs 565
Appendix D. ASCII Chart 573
Appendix E. Helper.h File 579
Appendix F. Linux Installation 581
Appendix G. About The CD-ROM 585
Index 587


Yashavant P. Kanetkar

Yashavant P. Kanetkar is a popular author and world-renowned instructor who has written several books and software programs in C and C++.

The following instructor resources are available to qualified instructors for download

ISBN-13: 9781934015254

Instructor Manual