Smaller C Lean Code for Small Machines (Marc Loy) (Z-Library)

Author: Marc Loy

科学

For makers looking to use the smallest microcontrollers or to wring the highest performance out of larger ones, the C language is still the best option. This practical book provides a solid grounding in C basics for anyone who tinkers with programming microcontrollers. You'll explore the many ways C enables developers and makers to get big results out of tiny devices. Author Marc Loy shows you how to write clean, maintainable C code from scratch. This language and its cousin, C++, are still widely used to write low-level code for device drivers or operating systems. By understanding C syntax and its quirks, you'll gain an enduring computer language literacy that will help you pick up new languages and styles more easily. • Learn C fundamentals, such as data types, flow control, and functions • Explore memory management including how programs work on small devices • Understand answers provided in online forums such as Reddit or Stack Overflow • Write efficient, custom C code that's both readable and maintainable • Analyze the performance of your code and weigh optimizations • Evaluate third-party libraries for use in your own projects • Create your own libraries to share with others

📄 File Format: PDF
💾 File Size: 20.7 MB
293
Views
82
Downloads
0.00
Total Donations

📄 Text Preview (First 20 pages)

ℹ️

Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

📄 Page 1
Marc Loy Smaller C Lean Code for Small Machines
📄 Page 2
(This page has no text content)
📄 Page 3
Marc Loy Smaller C Lean Code for Small Machines Boston Farnham Sebastopol TokyoBeijing
📄 Page 4
978-1-098-10033-9 [LSI] Smaller C by Marc Loy Copyright © 2021 Marc Loy. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://oreilly.com). For more information, contact our corporate/institutional sales department: 800-998-9938 or corporate@oreilly.com. Acquisitions Editor: Amanda Quinn Development Editor: Amelia Blevins Production Editor: Daniel Elfanbaum Copyeditor: nSight, Inc. Proofreader: Piper Editorial Consulting, LLC Indexer: nSight, Inc. Interior Designer: David Futato Cover Designer: Karen Montgomery Illustrator: Kate Dullea June 2021: First Edition Revision History for the First Edition 2021-05-27: First Release See http://oreilly.com/catalog/errata.csp?isbn=9781098100339 for release details. The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Smaller C, the cover image, and related trade dress are trademarks of O’Reilly Media, Inc. The views expressed in this work are those of the author, and do not represent the publisher’s views. While the publisher and the author have used good faith efforts to ensure that the information and instructions contained in this work are accurate, the publisher and the author disclaim all responsibility for errors or omissions, including without limitation responsibility for damages resulting from the use of or reliance on this work. Use of the information and instructions contained in this work is at your own risk. If any code samples or other technology this work contains or describes is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights.
📄 Page 5
Table of Contents Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix 1. The ABCs of C. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Strengths and Weaknesses 2 Getting Started 2 Tools Required 2 Creating a C “Hello, World” 15 Compiling Your Code 17 Running Your Code 17 Next Steps 19 2. Storing and Stating. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Statements in C 21 Statement Separators 22 Statement Flow 22 Variables and Types 24 Getting User Input 24 Strings and Characters 27 Numbers 29 Variable Names 31 Variable Assignments 32 printf() and scanf() 34 printf() Formats 34 Tailored Output 35 scanf() and Parsing Inputs 38 Operators and Expressions 39 Arithmetic Operators 39 Order of Operations 41 iii
📄 Page 6
Type Casting 42 Next Steps 45 3. Flow of Control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Boolean Values 47 Comparison Operators 48 Logical Operators 49 Branching 52 The if Statement 52 The switch Statement 58 The Ternary Operator and Conditional Assignment 63 Loop Statements 65 The for Statement 65 The while Statement 69 The do/while Variation 71 Nesting 72 Nested Loops and Tables 74 Variable Scope 75 Exercises 77 Next Steps 79 4. Bits and (Many) Bytes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 Storing Multiple Things with Arrays 81 Creating and Manipulating Arrays 82 Review of Strings 88 Multidimensional Arrays 89 Accessing Elements in Multidimensional Arrays 90 Storing Bits 91 Binary, Octal, Hexadecimal 92 Octal and Hexadecimal Literals in C 93 Input and Output of Octal and Hex Values 94 Bitwise Operators 96 Mixing Bits and Bytes 97 Conversion Answers 101 Next Steps 102 5. Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 Familiar Functions 104 Function Flow 104 Simple Functions 105 Sending Information to Functions 107 Passing Simple Types 107 iv | Table of Contents
📄 Page 7
Passing Strings to Functions 108 Multiple Types 110 Exiting a Function 110 Returning Information 111 Using Returned Values 112 Ignoring Returned Values 113 Nested Calls and Recursion 114 Recursive Functions 115 Variable Scope 118 Global Variables 119 The main() Function 121 Return values and main() 122 Command-Line Arguments and main() 123 Next Steps 125 6. Pointers and References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 Addresses in C 127 The NULL Value and Pointer Errors 129 Arrays 130 Local Variables and the Stack 131 Global Variables and the Heap 133 Pointer Arithmetic 134 Array Pointers 135 Functions and Pointers 137 Managing Memory with Arrays 138 Allocating with malloc() 138 Deallocating with free() 139 C Structures 140 Defining Structures 141 Assigning and Accessing Structure Members 141 Pointers to Structures 142 Functions and Structures 143 Pointer Syntax Recap 145 Next Steps 147 7. Libraries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 The C Standard Library 150 stdio.h 150 stdlib.h 150 string.h 154 math.h 157 time.h 159 Table of Contents | v
📄 Page 8
ctype.h 160 Putting It Together 161 Filling In Strings 161 Finding Our Interest 162 Finding New Libraries 163 Next Steps 164 8. Real-World C With Arduino. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 Arduino IDE (Win, Mac, Linux) 166 Installing on Windows 167 Installing on macOS 168 Installing on Linux 168 Your First Arduino Project 169 Selecting Your Board 170 Hello, LED! 172 An External LED Upgrade 175 Arduino Libraries 176 Managing Libraries 177 Using Arduino Libraries 178 Arduino Sketches and C++ 179 C++ Objects and Variables 182 More Practice with Objects 183 C++ Considerations 185 Object Homework 186 Next Steps 187 9. Smaller Systems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 The Arduino Environment 189 Special Values 190 Special Types 192 “Built-In” Functions 193 Trying Out the Arduino “Stuff ” 194 Microcontroller I/O 197 Sensors and Analog Input 197 The Serial Monitor 198 Is It Hot in Here? 199 Segmented Displays 200 Buttons and Digital Input 202 Just How Hot Is It? 204 Memory Management on Arduino 206 Flash (PROGMEM) 206 SRAM 209 vi | Table of Contents
📄 Page 9
EEPROM 211 Remembering Choices 212 Interrupts 215 Interrupt Service Routines 215 Interrupt-Driven Programming 216 Exercises 218 Next Steps 220 10. Faster Code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 The Setup 222 Floating-Point Versus Integer Math 223 Floating-Point Math Alternatives 224 Integer Math Versus No Math 225 Lookup Tables 226 The Project So Far 227 The Power of Powers of 2 229 Loop Optimizations 230 Unrolling for Fun and Profit 231 Recursion Versus Iteration 232 String Versus char[] 232 Our Final Offer 233 Next Steps 234 11. Custom Libraries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 Creating Your Own Library 235 Preprocessor Directives 238 Preprocessor Macros 239 Custom Type Definitions 240 Our Car Project 241 Multifile Projects 244 Code (.ino) Files 244 Header Files 247 Importing Custom Libraries 249 Facilitating Communication 249 Retrofitting Our Car 250 Creating a Controller 252 Creating the Library 253 Updating the Car Project 258 Getting It Under Control 260 Go Driving! 262 Documentation and Distribution 262 Next Steps 265 Table of Contents | vii
📄 Page 10
12. Next Next Steps. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 Intermediate and Advanced Topics 267 IoT and Arduino 268 Arduino Source Code 273 Other Microcontrollers 273 Industry C/C++ 274 Back to the Future 274 A. Hardware and Software. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 B. printf() Format Specifier Details. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281 Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 viii | Table of Contents
📄 Page 11
Preface In a world where new JavaScript frameworks come and go almost daily, why would you dive into an aging, bare-bones language like C? Well, for one, if you hope to keep up with all those framework fads (ouch, opinion alert), you might want a background in just such aging, bare-bones technologies that provide a foundation for so many “modern” languages. Did you look up popular programming languages on a site like TIOBE and find C consistently at the top? Maybe you’re interested in the amazingly advanced video cards and want to see how the software that drives them works. Or perhaps you’re exploring newer—and much smaller—gadgets like Arduinos and heard that C is the right tool for the job. No matter the reason, it’s great to have you here. All of those reasons are valid ones, by the way. C is a foundational language and understanding its syntax and quirks will give you a very long-lived computer language literacy that will help you pick up new languages and styles more easily. C (and its cousin C++) are still widely used when writing low-level code for device drivers or operating systems. And the Internet of Things is breathing new life into microcontrollers with limited resources. C is a great fit for wringing the most of those tiny environments. While I’ll be focusing on that last idea of writing clean, tight code for tiny, limited machines, I’ll still start with the basics of computer programming and cover a variety of rules and patterns that apply to C anywhere you might find it. How to Use This Book This book aims to cover all the basics of good C programming for any of the situa‐ tions mentioned above. We’ll look at control structures, operators, functions, and other elements of C’s syntax along with examples of alternate patterns that can shave a few bytes off the size of your compiled program. We’ll also be looking at the Ardu‐ ino environment as a great application for lean C code. To best enjoy the Arduino section, you should have some basic experience with building simple circuits and using components like LEDs and resistors. ix
📄 Page 12
Here’s a preview of the chapters: Chapter 1, The ABCs of C A brief look at the history of the C language and steps to set up your develop‐ ment environment. Chapter 2, Storing and Stating An introduction to statements in C, including basic I/O, variables, and operators. Chapter 3, Flow of Control Here I cover branching and looping statements and go a little deeper on variables and their scope. Chapter 4, Bits and (Many) Bytes A quick return to storing data. I show you C’s facilities for manipulating individ‐ ual bits and storing lots of bigger things in arrays. Chapter 5, Functions I’ll look at how to break up your code into manageable chunks. Chapter 6, Pointers and References Getting a little more advanced, I create more complex data structures and learn how to pass them to, and return them from, functions. Chapter 7, Libraries Learn how to find and use popular bits of code that can help you with common or intricate tasks. Chapter 8, Real-World C With Arduino The real fun begins! We’ll set up the Arduino development environment and make some LEDs blink. Chapter 9, Smaller Systems Try out several electronic peripherals including sensors, buttons, and LCD dis‐ plays with complete Arduino projects. Chapter 10, Faster Code Learn some tricks for writing code especially designed to help small processors get the most out of their resources. Chapter 11, Custom Libraries Build on your C library skills with tips and tricks for writing friendly, well- documented libraries compatible with the Arduino IDE. Chapter 12, Next Next Steps Try a quick Internet of Things project with a few parting thoughts and some ideas for what to try next as you continue to improve your lean coding skills. x | Preface
📄 Page 13
The appendices include a handy collection of links to the hardware and software I use, as well as information on downloading and configuring the C and Arduino examples shown throughout the book. Conventions Used in This Book The following typographical conventions are used in this book: Italic Indicates new terms, URLs, email addresses, filenames, and file extensions. Constant width Used for program listings, as well as within paragraphs to refer to program ele‐ ments such as variable or function names, databases, data types, environment variables, statements, and keywords. Constant width bold Shows commands or other text that should be typed literally by the user. Constant width italic Shows text that should be replaced with user-supplied values or by values deter‐ mined by context. This element signifies a tip or suggestion. This element signifies a general note. This element indicates a warning or caution. Using Code Examples Many of the code examples in this book are quite succinct, and you’ll often benefit from typing them in by hand. But that isn’t always fun and sometimes you want to start with a known, working copy and modify stuff. You can grab the source for all of Preface | xi
📄 Page 14
the examples from GitHub at https://github.com/l0y/smallerc. Appendix A has detailed instructions on downloading the code and setting up the files for use with your devel‐ opment environment. If you have a technical question or a problem using the code examples, please send an email to bookquestions@oreilly.com. This book is here to help you get your job done. In general, you may use the example code offered with this book in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission. We appreciate, but generally do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “Smaller C by Marc Loy (O’Reilly). Copyright 2021 Marc Loy, 978-1-098-10033-9.” If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at permissions@oreilly.com. O’Reilly Online Learning For more than 40 years, O’Reilly Media has provided technol‐ ogy and business training, knowledge, and insight to help companies succeed. Our unique network of experts and innovators share their knowledge and expertise through books, articles, and our online learning platform. O’Reilly’s online learning platform gives you on-demand access to live training courses, in-depth learning paths, interactive coding environments, and a vast collection of text and video from O’Reilly and 200+ other publishers. For more information, visit http://oreilly.com. How to Contact Us Please address comments and questions concerning this book to the publisher: O’Reilly Media, Inc. 1005 Gravenstein Highway North Sebastopol, CA 95472 xii | Preface
📄 Page 15
800-998-9938 (in the United States or Canada) 707-829-0515 (international or local) 707-829-0104 (fax) We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at https://oreil.ly/smaller-c. Email bookquestions@oreilly.com to comment or ask technical questions about this book. For news and information about our books and courses, visit http://oreilly.com. Find us on Facebook: http://facebook.com/oreilly. Follow us on Twitter: http://twitter.com/oreillymedia. Watch us on YouTube: http://youtube.com/oreillymedia. Acknowledgments I would like to thank Amelia Blevins for shepherding another book for me through the publication process. Her project management skills are surpassed only by her ability to improve my writing through her artful suggestions. Thanks also go to Amanda Quinn and Suzanne McQuade for helping me get the project off the ground in the first place, and Danny Elfanbaum for his superb tech support. The entire crew at O’Reilly are peerless. Our technical reviewers brought a wide range of expertise to the table, and I could not have asked for better feedback. Tony Crawford tightened up my C code discus‐ sions, and I heartily recommend you read his book: C in a Nutshell. Alex Faber ran every example in the book on multiple platforms and made sure I kept new program‐ mers in mind. Eric Van Hoose made my writing clearer and helped focus the flow of the book overall. Chaim Krause filled in at the last minute and highlighted a few gaps that have been duly filled in turn. Personal thanks to my husband Ron for wordsmithing advice and general moral sup‐ port. Reg Dyck also provided some welcome encouragement. If you ever want to really learn a topic, explain it to friends and family like Reg and Ron. Neither gent has much interest in programming or electronics, but their friendly questions helped me suss out the core of what I wanted to say on many difficult topics. Preface | xiii
📄 Page 16
(This page has no text content)
📄 Page 17
CHAPTER 1 The ABCs of C C is a powerful language. It is procedural (meaning you do a lot of your coding work with procedures) and compiled (meaning the code you write must be translated for use by a computer using a compiler). You can write your procedures anywhere you can edit a text file, and you can compile those procedures to run on anything from supercomputers to the tiniest of embedded controllers. It’s a fantastic, mature lan‐ guage—I’m glad you’re here learning about it! C has been around for quite some time: it was developed in the early 1970s by Dennis Ritchie at Bell Labs. You might have heard of him as one of the authors of the canoni‐ cal C programming book, The C Programming Language with Brian Kernighan (Pearson). (If you see or hear or read about the phrase “K&R” in the programming world, that’s a reference to the book.) As a general purpose, procedural language built with an eye toward keeping programmers connected to the hardware their programs would run on, C caught on with both academic and industrial institutions outside Bell Labs to run a growing array of computers and remains a viable systems programming language. Like all languages, C is not static. And with nearly 50 years under its belt, C has undergone many changes and spawned a great number of other languages. You can see its influence in the syntax of languages as disparate as Java and Perl. Indeed, some of C’s elements are so universal that you see it show up in pseudocode examples meant to represent “any” language. As C grew in popularity, it became necessary to organize and standardize its syntax and features. The first part of this book will focus on Standard C as defined by the International Organization for Standardization (ISO) and the code we write will be portable to any C compiler on any platform. The latter part of this book will focus on using C with specific hardware such as the Arduino microcontroller. 1
📄 Page 18
Strengths and Weaknesses When you think about solving actual problems with a computer these days, using a high-level language is a must. C provides a great balance between code you can think about and code that performs well when compiled for actual hardware. C has straightforward code structures and a wealth of useful operators. (These are the fea‐ tures that have spread into so many subsequent languages and makes it such a good option for lean code on microcontrollers.) C also gives you room to break problems up into smaller subproblems. You can reason about the code (and its inevitable bugs) as a human—quite a handy thing. C does have its downsides, though. C does not have some of the fancier features avail‐ able today in other languages such as Java’s automatic memory garbage collection. Many modern languages hide most of those details from the programmer at the expense of a little performance. C requires you to be more deliberate in how you allocate and manage resources like memory. Sometimes that requirement can feel tedious. C also lets you write some pretty impressive bugs. It has no type safety or really any safety checks at all. Again, as a programmer, this hands-off approach means you can write clever, efficient code that really hums on the hardware. It also means that if you get something wrong, it’s up to you to find and fix the problem. (Tools like linters and debuggers help; we’ll definitely be looking at those along the way.) Getting Started So how do we get started? As with any compiled language, we’ll first need a file con‐ taining some valid C instructions. We’ll then need a compiler that can translate those instructions. With the right contents in the file and a compiler for your own comput‐ er’s hardware, you can have a C program running in just a few minutes. If you have spent any time learning any computer language at all, you’re likely famil‐ iar with the idea of a “Hello, World” program. It’s an admirably simple idea: create a tiny program that proves several things in one go. It proves you can write valid code in the language. It proves your compiler or interpreter works. It also proves you can produce visible output, which comes in very handy for humans, as it turns out. Let’s get started! Tools Required Folks use computers today for a vast array of tasks. Entertainment such as games and streaming video takes up as many (if not more) CPU cycles as business productivity work or even application development. And because computers are used as much for consuming as they are for producing, very few systems come with the tools required 2 | Chapter 1: The ABCs of C
📄 Page 19
1 Well, “any” is awfully expansive; if your language is an interpreted language, then of course you would need a good interpreter rather than a good compiler! to do stuff like application development. Happily, those tools are freely available, but you do have to go get them yourself and then set them up to work on your system. As I’ve noted before, this book focuses on writing clean, efficient C code. I take care in our examples to avoid overly clever patterns. I also work hard to ensure the exam‐ ples do not rely on a particular compiler or a particular development platform. To that end, I’ll be working with the minimum setup required for any software develop‐ ment: a good editor and a good compiler.1 If you’re comfortable hunting down software online and want to dive right in, we’ll be installing Visual Studio Code (often just “VS Code”) from Microsoft as our editor and the GNU developer tools from the GNU Foundation to handle compiling. More links and details follow, but feel free to jump to “Creating a C ‘Hello, World’” on page 15 after installing these tools on your own or if you already have an editor and a com‐ piler you’re comfortable using. Windows Microsoft Windows owns the lion’s share of the desktop market. If you only write programs for one system, Windows gets you the most bang for your buck. But that means that you’ll find a lot more competition in the software that helps you write those programs. There are more commerical developer applications for Windows than any other platform. Fortunately, many of those applications have a free or “com‐ munity” version that will suffice for our purposes. (When we get to the Arduino focus in the second part of this book, we’ll be looking at some Arduino-specific tools that include compilers.) You can’t talk about Windows and software development without mentioning the Visual Studio IDE (Integrated Development Environment) from Microsoft. If you want to build applications for Windows itself, it’s hard to beat Visual Studio. They even offer a community edition for students and individual developers. While I won’t be discussing either edition for the examples in this book, Visual Studio is a great IDE for Windows users and will easily handle our code. (I will, however, be using a close cousin called Visual Studio Code as our editor on all three of the major platforms.) Another popular commerical IDE is CLion from Jetbrains. CLion is also cross-platform so you can easily move between different operating systems and still feel productive. If you have experience with any of the other quality applications from Jetbrains, CLion can be a familiar way to get started writing and debugging C code. Getting Started | 3
📄 Page 20
2 J. M. Eubank, however, has done the legwork on a single-file installer that you might want to check out if the general steps for a more complete setup look overwhelming: tdm-gcc. There are myriad other text editors, each with some pros and cons. You can even use tools like the built-in Notepad application, although programming-specific editors will have some handy features that can make reading and debugging your code easier. GNU tools on Windows. On Windows, installing the GCC tool from GNU can be a bit tedious. There’s no quick, friendly installer.2 You can find a variety of binary packages that provide most of what we need, but you still have to take care to download the GNU compiler subpackages and then configure your Windows environment. We will install the Cygwin environment to get our Windows version of GCC. Cygwin is a much larger collection of tools and utilities that provides Windows users with a nice Unix shell environment. But “nice” is pretty subjective, and if you don’t know Unix or its derivatives such as Linux or modern macOS, you probably won’t use much else of the collection. Grab the Cygwin setup executable. Once it’s done downloading, go ahead and launch it. You may need to “allow this app from an unknown publisher to make changes to your device.” You can try the “Install from Internet” option, but if you have any trou‐ ble, go back and use the “Download Without Installing” option. You’ll still want to follow the package selection step, but after the download completes, you can run this installer program a second time and choose the “Install from Local Directory” option and use the folder where you downloaded all of the packages. Go ahead and accept the defaults for any questions the installer asks. When you get to the mirror selection page, use one physically close to you if you can identify a univer‐ sity or business you know. Otherwise, any mirror should do—but it’s OK to come back and pick a different one if you have any troubles with the download. On the “Select Package” screen, you do need to make an extra selection as gcc is not included by default. Switch the View dropdown to “Full” and then enter “gcc” as a search term. You want the “gcc-core” package as highlighted in Figure 1-1. Any of the versions available are sufficient for our needs. At the time of this writing, we selected the most recent gcc-core version, which was 10.2.0-1. 4 | Chapter 1: The ABCs of C
The above is a preview of the first 20 pages. Register to read the complete e-book.

💝 Support Author

0.00
Total Amount (¥)
0
Donation Count

Login to support the author

Login Now

Recent Donations

匿名用户
2025-08-03 14:40
¥1.00
Back to List