+612 9045 4394
 
CHECKOUT
C by Example : Cambridge Computer Science Texts - Noel Kalicharan

C by Example

Cambridge Computer Science Texts

Paperback Published: 14th November 1994
ISBN: 9780521456500
Number Of Pages: 384

Share This Book:

Paperback

RRP $101.95
$95.40
or 4 easy payments of $23.85 with Learn more
This title is not in stock at the Booktopia Warehouse and needs to be ordered from our supplier.
Click here to read more about delivery expectations.

C is one of the most popular programming languages today. It is flexible, efficient and highly portable, and is used for writing many different kinds of programs, from compilers and assemblers to spreadsheets and games. This book is based on ANSI C - the recently adopted standard for the C language. It assumes familiarity with basic programming concepts such as variables, constants, iteration and looping, but covers all aspects of C. In general it is as much about learning programming skills as it is about mastering the art of coding programs in C. To this end the text contains a wealth of examples and exercises that foster and test the understanding of the concepts developed in each chapter. An outstanding feature of this book is the treatment of 'pointers'. The topic is presented in a clear logical and reasoned manner that is easy to follow. Binary files and random access files are also treated in such a manner that the reader can easily become adept at using them. Anybody who wishes to get to grips with the art of programming in C will find this a most valuable book.

"...provides a good introduction to programming in C." Michael Marcotty, Computing Reviews

Prefacep. xv
Getting Started With Cp. 1
The first examplep. 3
Running the programp. 4
A word on program layoutp. 6
Commentsp. 8
Data typesp. 9
Identifiersp. 11
Expressionsp. 13
Arithmetic operatorsp. 13
Assignment operatorsp. 14
Relational operatorsp. 15
Logical operatorsp. 16
Increment and decrement operatorsp. 17
Mixing operands in an expressionp. 17
Statementsp. 18
Standard input and outputp. 19
The while statementp. 23
The if ... else statementp. 26
Exercises 1p. 30
More Control Structures and Arraysp. 32
The for statementp. 32
The do ... while statementp. 36
The switch statementp. 40
The continue statementp. 42
Arraysp. 43
Stringsp. 48
Sequential and binary searchp. 50
Exercises 2p. 52
Functions - the Basicsp. 55
An example - factorialp. 55
Function definitionp. 60
Sequential searchp. 61
Binary searchp. 63
The One-Zero gamep. 64
Exercises 3p. 72
Character Handlingp. 76
Character setsp. 77
getchar and putcharp. 79
Example - letter frequency countp. 83
Strings (arrays of characters)p. 86
Example - word frequency countp. 93
Hashingp. 94
Back to the problemp. 98
Insertion sortp. 106
Sorting the wordsp. 110
Printing the tablep. 111
Exercises 4p. 118
Functions and Pointersp. 120
Parameter passingp. 120
Pointer variablesp. 125
More on parameter passingp. 129
A voting problemp. 131
Character pointersp. 139
Pointer arithmeticp. 141
Pointers to functionsp. 145
Near, far and huge pointersp. 149
Recursionp. 150
An example - Towers of Hanoip. 151
An example - decimal to binaryp. 153
An example - quicksortp. 153
Exercises 5p. 157
Data Types, Operators and Storage Classesp. 160
Data typesp. 160
Operatorsp. 164
Bit operatorsp. 167
Conditional expressionsp. 170
Storage classes in Cp. 171
automaticp. 172
externalp. 173
staticp. 177
registerp. 179
Other scope rulesp. 179
Initializationp. 180
Simple variablesp. 180
Array variablesp. 181
Two-dimensional arraysp. 184
Exercises 6p. 185
Basic Structures and Linked Listsp. 187
The voting problem revisitedp. 187
typedefp. 189
Passing structures to functionsp. 192
Pointers to structuresp. 201
Linked listsp. 202
Dynamic storage allocation - malloc, calloc, sizeofp. 204
Building a linked list - version 1p. 208
Some characteristics of linked listsp. 210
Building a linked list - version 2p. 211
Deletion from a linked listp. 213
Building a linked list - version 3p. 214
Exercises 7p. 217
Binary Trees and Other Structuresp. 221
Binary treesp. 221
Representing a binary treep. 228
Binary search treesp. 228
A cross-reference programp. 233
Initialization of an array of structuresp. 243
Nested structuresp. 244
Unionsp. 245
Bit-fieldsp. 250
Exercises 8p. 253
Standard Input/Outputp. 256
stdin, stdout, stderrp. 256
I/O routinesp. 257
Text and binary filesp. 258
Functions for standard input/outputp. 259
getchar and putcharp. 259
gets and putsp. 259
printfp. 260
scanfp. 268
Exercises 9p. 277
File Input/Outputp. 279
Internal vs external file namep. 279
fopen and fclosep. 280
getc and putcp. 284
File processing example - telephone chargesp. 285
feof and ferrorp. 290
fgets and fputsp. 291
sprintf and sscanfp. 295
Input/output for binary filesp. 296
fread and fwritep. 296
Random access filesp. 300
rewind and fseekp. 300
Indexed filesp. 303
Updating a random access filep. 312
Exercises 10p. 318
Miscellaneous Topicsp. 320
The C preprocessorp. 320
The #define directivep. 321
The #undef directivep. 333
The #include directivep. 333
Conditional compilation - #if, #elif, #else, #endif directivesp. 333
Command-line arguments - argc and argvp. 335
Two-dimensional arraysp. 337
Matrix multiplicationp. 339
Magic squaresp. 340
Enumerated types - enump. 344
The goto statementp. 349
const and volatilep. 349
Exercises 11p. 350
Appendices
List of C keywordsp. 353
Differences between ANSI C and traditional Cp. 354
ASCII character setp. 357
Indexp. 359
Table of Contents provided by Syndetics. All Rights Reserved.

ISBN: 9780521456500
ISBN-10: 0521456509
Series: Cambridge Computer Science Texts
Audience: General
Format: Paperback
Language: English
Number Of Pages: 384
Published: 14th November 1994
Publisher: CAMBRIDGE UNIV PR
Country of Publication: GB
Dimensions (cm): 23.27 x 15.34  x 2.39
Weight (kg): 0.58