TIENE EN SU CESTA DE LA COMPRA
en total 0,00 €
C Primer Plus is a carefully tested, well-crafted, and complete tutorial on a subject core to programmers and developers. This computer science classic teaches principles of programming, including structured code and top-down design.
Author and educator Stephen Prata has created an introduction to C that is instructive, clear, and insightful. Fundamental programming concepts are explained along with details of the C language. Many short, practical examples illustrate just one or two concepts at a time, encouraging readers to master new topics by immediately putting them to use.
Review questions and programming exercises at the end of each chapter bring out the most critical pieces of information and help readers understand and digest the most difficult concepts. A friendly and easy-to-use self-study guide, this book is appropriate for serious students of programming, as well as developers proficient in other languages with a desire to better understand the fundamentals of this core language.
The sixth edition of this book has been updated and expanded to cover the latest developments in C as well as to take a detailed look at the new C11 standard. In C Primer Plus you'll find depth, breadth, and a variety of teaching techniques and tools to enhance your learning:
Complete, integrated discussion of both C language fundamentals and additional features
Clear guidance about when and why to use different parts of the language
Hands-on learning with concise and simple examples that develop your understanding of a concept or two at a time
Hundreds of practical sample programs
Review questions and programming exercises at the end of each chapter to test your understanding
Coverage of generic C to give you the greatest flexibility
Preface xxvii
1 Getting Ready 1
Whence C? 1
Why C? 2
Design Features 2
Efficiency 3
Portability 3
Power and Flexibility 3
Programmer Oriented 3
Shortcomings 4
Whither C? 4
What Computers Do 5
High-level Computer Languages and Compilers 6
Language Standards 7
The First ANSI/ISO C Standard 8
The C99 Standard 8
The C11 Standard 9
Using C: Seven Steps 9
Step 1: Define the Program Objectives 10
Step 2: Design the Program 10
Step 3: Write the Code 11
Step 4: Compile 11
Step 5: Run the Program 12
Step 6: Test and Debug the Program 12
Step 7: Maintain and Modify the Program 13
Commentary 13
Programming Mechanics 13
Object Code Files, Executable Files, and Libraries 14
Unix System 16
The GNU Compiler Collection and the LLVM Project 18
Linux Systems 18
Command-Line Compilers for the PC 19
Integrated Development Environments (Windows) 19
The Windows/Linux Option 21
C on the Macintosh 21
How This Book Is Organized 22
Conventions Used in This Book 22
Typeface 22
Program Output 23
Special Elements 24
Summary 24
Review Questions 25
Programming Exercise 25
2 Introducing C 27
A Simple Example of C 27
The Example Explained 28
Pass 1: Quick Synopsis 30
Pass 2: Program Details 31
The Structure of a Simple Program 40
Tips on Making Your Programs Readable 41
Taking Another Step in Using C 42
Documentation 43
Multiple Declarations 43
Multiplication 43
Printing Multiple Values 43
While You're at It-Multiple Functions 44
Introducing Debugging 46
Syntax Errors 46
Semantic Errors 47
Program State 49
Keywords and Reserved Identifiers 49
Key Concepts 50
Summary 51
Review Questions 51
Programming Exercises 53
3 Data and C 55
A Sample Program 55
What's New in This Program? 57
Data Variables and Constants 59
Data: Data-Type Keywords 59
Integer Versus Floating-Point Types 60
The Integer 61
The Floating-Point Number 61
Basic C Data Types 62
The int Type 62
Other Integer Types 66
Using Characters: Type char 71
The _Bool Type 77
Portable Types: stdint.h and inttypes.h 77
Types float, double, and long double 79
Complex and Imaginary Types 85
Beyond the Basic Types 85
Type Sizes 87
Using Data Types 88
Arguments and Pitfalls 89
One More Example: Escape Sequences 91
What Happens When the Program Runs 91
Flushing the Output 92
Key Concepts 93
Summary 93
Review Questions 94
Programming Exercises 97
4 Character Strings and Formatted Input/Output 99
Introductory Program 99
Character Strings: An Introduction 101
Type char Arrays and the Null Character 101
Using Strings 102
The strlen() Function 103
Constants and the C Preprocessor 106
The const Modifier 109
Manifest Constants on the Job 109
Exploring and Exploiting printf() and scanf() 112
The printf() Function 112
Using printf() 113
Conversion Specification Modifiers for printf() 115
What Does a Conversion Specification Convert? 122
Using scanf() 128
The * Modifier with printf() and scanf() 133
Usage Tips for printf() 135
Key Concepts 136
Summary 137
Review Questions 138
Programming Exercises 140
5 Operators, Expressions, and Statements 143
Introducing Loops 144
Fundamental Operators 146
Assignment Operator: = 146
Addition Operator: + 149
Subtraction Operator: - 149
Sign Operators: - and + 150
Multiplication Operator: * 151
Division Operator: / 153
Operator Precedence 154
Precedence and the Order of Evaluation 156
Some Additional Operators 157
The sizeof Operator and the size_t Type 158
Modulus Operator: % 159
Increment and Decrement Operators: ++ and -- 160
Decrementing: -- 164
Precedence 165
Don't Be Too Clever 166
Expressions and Statements 167
Expressions 167
Statements 168
Compound Statements (Blocks) 171
Type Conversions 174
The Cast Operator 176
Function with Arguments 177
A Sample Program 180
Key Concepts 182
Summary 182
Review Questions 183
Programming Exercises 187
6 C Control Statements: Looping 189
Revisiting the while Loop 190
Program Comments 191
C-Style Reading Loop 192
The while Statement 193
Terminating a while Loop 194
When a Loop Terminates 194
while: An Entry-Condition Loop 195
Syntax Points 195
Which Is Bigger: Using Relational Operators and Expressions 197
What Is Truth? 199
What Else Is True? 200
Troubles with Truth 201
The New _Bool Type 203
Precedence of Relational Operators 205
Indefinite Loops and Counting Loops 207
The for Loop 208
Using for for Flexibility 210
More Assignment Operators: +=, -=, *=, /=, %= 215
The Comma Operator 215
Zeno Meets the for Loop 218
An Exit-Condition Loop: do while 220
Which Loop? 223
Nested Loops 224
Program Discussion 225
A Nested Variation 225
Introducing Arrays 226
Using a for Loop with an Array 228
A Loop Example Using a Function Return Value 230
Program Discussion 232
Using Functions with Return Values 233
Key Concepts 234
Summary