Book description
Get started with writing simple programs in C while learning core programming concepts
Key Features
- Learn essential C concepts such as variables, data structures, functions, loops, and pointers
- Grasp the core programming aspects that form the base of many modern programming languages
- Work with updated code samples and cover array declaration and initialization in detail in this new edition
Book Description
The foundation for many modern programming languages such as C++, C#, JavaScript, and Go, C is widely used as a system programming language as well as for embedded systems and high-performance computing. With this book, you'll be able to get up to speed with C in no time.
The book takes you through basic programming concepts and shows you how to implement them in the C programming language. Throughout the book, you'll create and run programs that demonstrate essential C concepts, such as program structure with functions, control structures such as loops and conditional statements, and complex data structures. As you make progress, you'll get to grips with in-code documentation, testing, and validation methods. This new edition expands upon the use of enumerations, arrays, and additional C features, and provides two working programs based on the code used in the book. What's more, this book uses the method of intentional failure, where you'll develop a working program and then purposely break it to see what happens, thereby learning how to recognize possible mistakes when they happen.
By the end of this C programming book, you'll have developed basic programming skills in C that can be easily applied to other programming languages and have gained a solid foundation for you to build on as a programmer.
What you will learn
- Implement fundamental programming concepts through C programs
- Understand the importance of creating complex data types and the functions to manipulate them
- Develop good coding practices and learn to write clean code
- Validate your programs before developing them further
- Use the C Standard Library functions and understand why it is advantageous
- Build and run a multi-file program with Make
- Get an overview of how C has changed since its introduction and where it is going
Who this book is for
If you're an absolute beginner who has basic familiarity with operating a computer, this book will help you learn the most fundamental concepts and practices that you need to know to become a successful C programmer. If you're an experienced programmer, you'll find the full range of C syntax as well as common C idioms covered in the book useful.
Table of contents
- Learn C Programming Second Edition
- Contributors
- About the author
- About the reviewers
- Preface
- Part 1: C Fundamentals
- Chapter 1:Running Hello, World!
- Chapter 2: Understanding Program Structure
- Chapter 3: Working with Basic Data Types
- Chapter 4: Using Variables and Assignments
- Chapter 5: Exploring Operators and Expressions
- Chapter 6: Exploring Conditional Program Flow
-
Chapter 7: Exploring Loops and Iterations
- Technical requirements
- Understanding repetition
- Understanding brute-force repetition
- Introducing the while()… statement
- Introducing the for()… statement
- Introducing the do … while() statement
- Understanding loop equivalency
- Understanding unconditional branching – the dos and (mostly) don'ts of goto
- Further controlling loops with break and continue
- Understanding infinite loops
- Summary
- Questions
- Chapter 8: Creating and Using Enumerations
- Part 2: Complex Data Types
- Chapter 9: Creating and Using Structures
- Chapter 10: Creating Custom Data Types with typedef
- Chapter 11: Working with Arrays
-
Chapter 12: Working with Multi-Dimensional Arrays
- Technical requirements
- Going beyond 1D arrays to multi-dimensional arrays
- Declaring and initializing multi-dimensional arrays of various dimensions
- Accessing elements of multi-dimensional arrays of various dimensions
- Manipulating multi-dimensional arrays using loops within loops
- Using multi-dimensional arrays in functions
- Summary
- Questions
- Chapter 13: Using Pointers
- Chapter 14: Understanding Arrays and Pointers
- Chapter 15: Working with Strings
- Chapter 16: Creating and Using More Complex Structures
- Part 3: Memory Manipulation
- Chapter 17: Understanding Memory Allocation and Lifetime
- Chapter 18: Using Dynamic Memory Allocation
- Part 4: Input and Output
- Chapter 19: Exploring Formatted Output
- Chapter 20: Getting Input from the Command Line
- Chapter 21: Exploring Formatted Input
- Chapter 22: Working with Files
- Chapter 23: Using File Input and File Output
- Part 5: Building Blocks for Larger Programs
- Chapter 24: Working with Multi-File Programs
- Chapter 25: Understanding Scope
- Chapter 26: Building Multi-File Programs with Make
- Chapter 27:Creating Two Card Programs
-
Appendix
- C definition and keywords
- C keywords
- Table of operators and their precedence
- Summary of useful GCC and Clang compiler options
- ASCII character set
- The Better String Library (Bstrlib)
- A quick introduction to Bstrlib
- A few simple examples
- Unicode and UTF-8
- A UTF to Unicode example
- The C standard library
- Method 1
- Method 2
- Method 3
- Epilogue
-
Assessments
- Chapter 2 – Understanding Program Structure
- Chapter 3 – Working with Basic Data Types
- Chapter 4 – Using Variables and Assignments
- Chapter 5 – Exploring Operators and Expressions
- Chapter 6 – Exploring Conditional Program Flow
- Chapter 7 – Exploring Loops and Iteration
- Chapter 8 – Creating and Using Enumerations
- Chapter 9 – Creating and Using Structures
- Chapter 10 – Creating Custom Data Types with typedef
- Chapter 11 – Working with Arrays
- Chapter 12 – Working with Multi-Dimensional Arrays
- Chapter 13 – Using Pointers
- Chapter 14 – Understanding Arrays and Pointers
- Chapter 15 – Working with Strings
- Chapter 16 – Creating and Using More Complex Structures
- Chapter 17 – Understanding Memory Allocation and Lifetime
- Chapter 18 – Using Dynamic Memory Allocation
- Chapter 19 – Exploring Formatted Output
- Chapter 20 – Getting Input from the Command Line
- Chapter 21 – Exploring Formatted Input
- Chapter 22 – Working with Files
- Chapter 23 – Using File Input and File Output
- Chapter 24 – Working with Multi-File Programs
- Chapter 25 – Understanding Scope
- Why subscribe?
- Other Books You May Enjoy
Product information
- Title: Learn C Programming - Second Edition
- Author(s):
- Release date: August 2022
- Publisher(s): Packt Publishing
- ISBN: 9781801078450
You might also like
book
Learn C Programming
Get started with writing simple programs in C while learning the skills that will help you …
book
Programming in C, Fourth Edition
will teach you how to write programs in the C programming language. Whether you’re a novice …
book
C Programming Language, 2nd Edition
This book is meant to help the reader learn how to program in C. It is …
video
Learn and Master C Programming For Absolute Beginners!
In this course, we'll explore the C programming language from the ground up. We'll begin with …