Introduction to C Programming

  • ISBN13:


  • ISBN10:


  • Edition: CD
  • Format: Paperback
  • Copyright: 2013-04-19
  • Publisher: Oxford University Press
  • Purchase Benefits
  • Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $31.95


Introduction to C Programming is designed to serve as a textbook for students of engineering, computer applications, and computer science for a basic course on C programming. The aim of the book is to enable students to write effective C programs.

The book starts with an introduction to programming in general followed by a detailed introduction to C programming. It then delves into a complete analysis of various constructs of C such as decision control and looping statements, functions, arrays, strings, pointers, structure and union, file management, and preprocessor directives. It also provides a separate chapter on linked list detailing the various kinds of linked lists and how they are used to allocate memory dynamically.

A highly detailed pedagogical approach is followed throughout the book, which includes plenty of examples, figures, programming tips, keywords, and end-chapter exercises which make this book an ideal resource for students to master and fine-tune the art of writing C programs.

Author Biography

Reema Thareja, Assistant Professor, Department of Computer Science, Shyama Prasad Mukherjee College for Women, University of Delhi

Reema Thareja is Assistant Professor at Department of Computer Science, Shyama Prasad Mukherjee College for Women, University of Delhi. She has completed MCA (Software Engineering) and MPhil (Computer Science). She specializes in programming languages, OS, microprocessors, DBMS, multimedia, and web technologies and is currently pursuing research in the area of improving data warehouse quality.

Table of Contents

Brief Contents
1.1 Introduction to Computer Software 1
1.2 Classification of Computer Software 2
System Software?2
Application Software?5
1.3 Programming Languages?6
1.4 Generation of Programming Languages?6
First Generation: Machine Language?6
Second Generation: Assembly Language?7
Third Generation Programming Language?8
Fourth Generation: Very High-Level Languages?8
Fifth Generation Programming Language?9
2.1 Introduction?12
Characteristics of C?13
Uses of C?14
2.2 Structure of a C Program?14
2.3 Writing the First C Program?15
2.4 Files Used in a C Program?16
Source Code File?16
Header Files?16
Object Files?17
Binary Executable File?17
2.5 Compiling and Executing C Programs?17
2.6 Using Comments?18
2.7 Keywords?19
2.8 Identifiers?20
Rules for Forming Identifier Names?20
2.9 Basic Data Types in C?20
How are Float and Double Stored??21
2.10 Variables?22
Numeric Variables?22
Character Variables?22
Declaring Variables?22
Initializing Variables?23
2.11 Constants?23
Integer Constant?23
Floating Point Constant?24
Character Constant?24
String Constant?24
Declaring Constants?24
2.12 Input/Output Statement in C?25
Formatting Input/Output?25
Examples printf/scanf?30
Detecting Errors During Data Input?33
2.13 Operators in C?33
Arithmetic Operators?33
Relational Operators?35
Equality Operators?36
Logical Operators?36
Unary Operators?37
Conditional Operator?39
Bitwise Operators?40
Assignment Operators?41
Comma Operator?42
Sizeof Operator?42
Operator Precedence Chart?42
2.14 Programming Examples?45
2.15 Type Conversion and Type Casting?48
Type Conversion?49
Annexure 1?60
3.1Introduction to Decision Control Statements?63
3.2Conditional Branching Statements?63
If Statement?64
If-Else Statement?65
If-Else-If Statement?68
Switch Case?72
3.3Iterative Statements?76
While loop?76
Do-while Loop?79
For Loop?82
3.4Nested Loops?86
3.5The Break and Continue Statement?96
The Break Statement?96
The Continue Statement?96
3.6Goto Statement?98
Case Study for Chapters 2 and 3?111
Why are Functions Needed??118
4.2 Using Functions?119
4.3 Function Declaration/Function Prototype?119
4.4 Function Definition?120
4.5 Function Call?121
Points to Remember While Calling a Function?121
4.6 Return Statement?122
Using Variable Number of Arguments?123
4.7 Passing Parameters to the Function?123
Call by Value?123
Call by Reference?125
4.8 Scope of Variables?128
Block Scope?129
Function Scope?129
Program Scope?130
File Scope?130
4.9 Storage Classes?131
The auto Storage Class?131
The register Storage Class?131
The extern Storage Class?132
The static Storage Class?133
Comparison of Storage Classes?134
4.10 Recursive Functions?134
Greatest Common Divisor?135
Finding Exponents?136
The Fibonacci Series?136
4.11 Types of Recursion?137
Direct Recursion?137
Indirect Recursion?137
Tail Recursion?138
Linear and Tree Recursion?138
4.12 Tower of Hanoi?138
4.13 Recursion Versus Iteration?141
Annexure 2?148
5.ARRAYS 149
5.1 Introduction?149
5.2 Declaration of Arrays?150
5.3 Accessing Elements of the Array?151
Calculating the Address of Array Elements?152
5.4 Storing Values in Arrays?153
Initialization of Arrays?153
Inputting Values?154
Assigning Values?154
5.5 Calculating the Length of the Array 154
5.6 Operations that Can be Performed on Arrays?155
Searching the Array Elements?168
5.7 One-Dimensional Arrays for Inter-Function Communication?171
5.8 Two-Dimensional Arrays?175
Declaration of Two-dimensional Arrays?176
Initialization of Two-dimensional Arrays?177
Accessing the Elements?178
5.9 Operations on Two-dimensional (2d) Arrays?181
5.10 Two-Dimensional Arrays For Inter-Function Communication?184
Passing a Row?185
Passing an Entire 2D Array?185
5.11 Multidimensional Arrays?187
5.12 Sparse Matrices?188
Annexure 3?196
Case Study for Chapters 4 and 5?208
6. STRINGS 219
6.1 Introduction?219
Reading Strings?221
Writing Strings?222
Summary of Functions Used to Read and Write Characters?222
6.2 Suppressing Input?224
Using a Scanset?224
6.3 String Taxonomy?226
6.4 String Operations?226
Converting Characters of a String into Upper Case?227
Converting Characters of a String into Lower Case?228
Concatenating Two Strings to form a New String?229
Comparing Two Strings?230
Reversing a String?231
Extracting a Substring from Left?232
Extracting a Substring from Right of the String?233
Extracting a Substring from the Middle of a String?233
6.5 Miscellaneous String and Character Functions?237
Character Manipulation Functions?237
String Manipulation Functions?238
6.6 Array of Strings?243
7.1 Understanding the Computer's Memory?257
7.2 Introduction to Pointers?258
7.3 Declaring Pointer Variables?259
7.4 Pointer Expressions and Pointer Arithmetic ?262
7.5 Null Pointers?266
7.6 Generic Pointers?267
7.7 Passing Arguments to Function Using Pointers?267
7.8 Pointers and Arrays?269
7.9 Passing an Array to a Function?272
7.10 Difference Between Array Name and Pointer?273
7.11 Pointers and Strings?274
7.12 Array of Pointers?278
7.13 Pointers and 2-D Arrays?280
7.14 Pointers and 3-D array?282
7.15 Function Pointers?283
Initializing a Function Pointer?283
Calling a Function Using a Function Pointer?284
Comparing Function Pointers?284
Passing a Function Pointer as an Argument to a Function?284
7.16 Array of Function Pointers?285
7.17 Pointers to Pointers?286
7.18 Memory Allocation in C Programs?286
7.19 Memory Usage?287
7.20 Dynamic Memory Allocation?287
Memory Allocations Process?287
Allocating a Block of Memory?288
Releasing the Used Space?289
To Alter the Size of Allocated Memory?289
7.21 Drawback of Pointers?291
Annexure 4?300
Case Study for Chapters 6 and 7?303
8.1 Introduction?308
Structure Declaration?308
Typedef Declarations?310
Initialization of Structures?310
Accessing the Members of a Structure?311
Copying and Comparing Structures?312
8.2 Nested Structures?314
8.3 Arrays of Structures?315
8.4 Structures and Functions?318
Passing Individual Members?318
Passing the Entire Structure?318
Passing Structures Through Pointers?322
8.5 Self-Referential Structures?327
8.6 Union?327
Declaring a Union?327
Accessing a Member of a Union?327
Initializing Unions ?328
8.7 Arrays of Union Variables?328
8.8 Unions Inside Structures?329
8.9 Enumerated Data Types?330
enum Variables?331
Using the Typedef Keyword?331
Assigning Values to Enumerated Variables?331
Enumeration Type Conversion?331
Comparing Enumerated Types?332
Input/Output Operations on Enumerated Types?332
Annexure 5?339
9. FILES 341
9.1 Introduction to Files?341
Streams in C?341
Buffer Associated with File Stream?342
Types of Files?342
9.2 Using Files in C?343
Declaring a File Pointer Variable?343
Opening a File?344
Closing a File Using fclose ()?345
9.3 Read Data from Files?345
fscanf ()?346
fgets ()?347
fgetc ()?347
fread ()?348
9.4 Writing Data to Files?349
fprintf ()?349
fputs ()?350
fputc ()?351
fwrite ()?351
9.5 Detecting the End-of-File?352
9.6 Error Handling During File Operations?353
perror ()?354
9.7 Accepting Command Line Arguments?354
9.8 Functions for Selecting a Record Randomly?368
fseek ()?368
ftell ()?371
rewind ()?371
fgetpos ()?372
fsetpos ()?372
9.9 remove ()?373
9.10 Renaming the File?373
9.11 Creating a Temporary File?373
10.1 Introduction?379
10.2 Types of Preprocessor Directives?380
10.3 #define?380
Object-Like Macro?380
Function-like Macros?381
Nesting of Macros?382
Rules for Using Macros?382
Operators Related to Macros?383
10.4 #include?383
10.5 #undef?384
10.6 #line?385
10.7 Pragma Directives?385
10.8 Conditional Directives?387
The #if Directive?388
The #else Directive?389
The #elif Directive?389
The #endif Directive?390
The defined Operator?390
10.10 #error Directive?390
10.11 Predefined Macro Names?391
Annexure 6?395
11.1 Introduction?400
11.2 Linked Lists Versus Arrays?402
11.3 Memory Allocation and Deallocation for a Linked List?402
11.4 Different Types of Linked Lists?404
11.5 Singly Linked List?404
Traversing a Singly Linked List?404
Searching a Linked List?405
Inserting a New Node in a Linked List?406
11.6 Circular Linked List?417
11.7 Doubly Linked List?418
11.8 Circular Doubly Linked List?419
11.9 Header Linked List?420
Case Study for Chapters 8, 9, and 11?426
Index 432

Rewards Program

Write a Review