Log In
Or create an account -> 
Imperial Library
  • Home
  • About
  • News
  • Upload
  • Forum
  • Help
  • Login/SignUp

Index
Title Page Copyright and Credits
Learn C Programming
Dedication About Packt
Why subscribe?
Contributors
About the author About the reviewer Packt is searching for authors like you
Preface
Who this book is for What this book covers To get the most out of this book Download the example code files Download the color images Conventions used Get in touch Reviews
Section 1: C Fundamentals Running Hello, World!
Technical requirements Writing your first C program Hello, world! Understanding the program development cycle Edit Compile Many C compilers for every OS Installing a compiler on Linux, macOS, or Windows Run Verify Repeat A note about debugging Creating, typing, and saving your first C program Running your first C program Writing comments to clarify the program later Some guidelines on commenting code Adding comments to the Hello, world! program Learning to experiment with code Summary
Understanding Program Structure
Technical requirements Introducing statements and blocks Experimenting with statements and blocks Understanding delimiters Understanding whitespace Introducing functions Exploring function identifiers Exploring function return values Passing in values with function parameters Order of execution Understanding function declarations Summary
Working with Basic Data Types
Technical requirements Understanding data types Bytes and chunks of data Representing whole numbers Representing positive and negative whole numbers Specifying different sizes of integers Representing numbers with decimals Representing single characters Representing Boolean true/false Understanding the sizes of data types Thesizeof()perator Ranges of values Summary
Using Variables and Assignment
Technical requirements Understanding types and values Introducing variables Naming variables Introducing explicit types of variables Using explicit typing with initialization Exploring constants Literal constants Defined values Explicitly typed constants Naming constant variables Using types and assignment Using explicit assignment, the simplest statement Assigning values by passing function parameters Assignment by the function return value Summary
Exploring Operators and Expressions
Technical requirements Expressions and operations Introducing operations on numbers Considering the special issues resulting from operations on numbers Understanding NaN Understanding underflow NaN Understanding overflow NaN Considering precision Exploring type conversion Understanding implicit type conversion and values Using explicit type conversion – casting Introducing operations on characters Exploring logical and relational operators Bitwise operators The conditional operator The sequence operator Compound assignment operators Multiple assignments in a single expression Incremental operators Postfix versus prefix incrementation Order of operations and grouping Summary
Exploring Conditional Program Flow
Technical requirements Understanding conditional expressions Introducing the if()… else…  complex statement Using a switch()… complex statement Introducing multiple if()… statements Using nested if()… else… statements The dangling else… problem Summary
Exploring Loops and Iteration
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
Creating and Using Enumerations
Technical requirements Introducing enumerations Defining enumerations Using enumerations The switch()… statement revisited Summary
Section 2: Complex Data Types Creating and Using Structures
Technical requirements Understanding structures Declaring structures Initializing structures and accessing structure elements Performing operations on structures  functions Structures of structures Initializing structures with functions Printing a structure of structures  reusing functions The stepping stone to object-oriented programming Summary
Creating Custom Data Types with typedef
Technical requirements Renaming intrinsic types with typedef Using synonyms Simplifying the use of enum types with typedef Simplifying the use of struct types with typedef Other uses oftypedef Some more useful compiler options Using a header file for custom types and the typedef specifiers Summary
Working with Arrays
Technical requirements Initializing arrays Assigning values to array elements Summary
Working with Multi-Dimensional Arrays
Technical requirements Revisiting one-dimensional arrays Moving on to two-dimensional arrays Moving on to three-dimensional arrays Considering N-dimensional arrays Declaring arrays of two dimensions Initializing arrays of two dimensions Declaring arrays of three dimensions Initializing arrays of three dimensions Declaringnitializing arrays of N dimensions Using nested loops to traverse a two-dimensional array Using nested loops to traverse a three-dimensional array Using multi-dimensional arrays in functions Summary
Using Pointers
Technical requirements Addressing pointers – the boogeyman of C programming Why use pointers at all? Introducing pointers Understanding direct addressing and indirect addressing Understanding memory and memory addressing Exploring some analogies in the real world Declaring the pointer type Naming pointers Assigning pointer values (addresses) Assigning pointer values Differentiating between the NULL pointer and void* Understanding the void* type Accessing pointer targets Pointer arithmetic Comparing pointers Verbalizing pointer operations Passing addresses to functions without pointer variables  Pointers to pointers Accessing structures and their elements via pointers Using pointers to structures in functions Summary
Understanding Arrays and Pointers
Technical requirements Understanding array names and pointers Accessing array elements via pointers Using pointer arithmetic Using the increment operator Passing arrays as function pointers revisited Interchangeability of array names and pointers Summary
Working with Strings
Technical requirements Characters – the building blocks of strings The char type and ASCII Operations on characters Getting information about characters Manipulating characters Exploring C strings An array with a terminator Strengths of C strings Weaknesses of C strings Declaring and initializing a string String declarations Initializing strings Passing a string to a function Empty strings versus null strings Hello, World! revisited Creating and using an array of strings Common operations on strings – the standard library Common functions Safer string operations Summary
Creating and Using More Complex Structures
Technical requirements Introducing the need for complex structures  Revisiting card4.h Understanding an array of structures Creating an array of structures Accessing structure elements within an array Manipulating an array of structures Using a structure with other structures Creating a structure consisting of other structures Accessing structure elements within the structure Manipulating  Using a structure with arrays Understanding randomness and random number generators Creating a structure with an array Accessing array elements within a structure Manipulating a Using a structure with an array of structures Creating a structure with an array of structures Accessing individual structure elements of the array within a structure Manipulating a s Completing carddeck.c Revisiting the deck structure Revisiting deck operations A basic card program Summary
Section 3: Memory Manipulation Understanding Memory Allocation and Lifetime
Technical requirements Defining storage classes Understanding automatic versus dynamic storage classes Automatic storage Dynamic storage Understanding internal versus external storage classes Internal or local storage classes External or global storage classes The lifetime of automatic storage Exploring the static storage class Internal static storage External static storage The lifetime of static storage Summary
Using Dynamic Memory Allocation
Technical requirements A brief tour of C's memory layout Allocating and releasing dynamic memory Allocating dynamic memory Releasing dynamic memory Accessing dynamic memory The lifetime of dynamic memory Special considerations for dynamic allocation Heap memory management Memory leaks The linked list dynamic data structure Linked list structures Declaring operations on a linked list Pointers to functions More complex operations on a linked list A program to test our linked list structure Summary
Section 4: Input and Output Exploring Formatted Output
Technical requirements Revisiting printf() Understanding the general format specifier form Using format specifiers for unsigned integers Using unsigned integers in different bases Considering negative numbers as unsigned integers Exploring powers of 2 and 9 in different bases Printing pointer values Using format specifiers for signed integers Using the signed integer field width, precision, alignment, and zero-filling Formatting long-long integers Powers of 2 and 9 with different modifiers Using format specifiers for floats and doubles Using the floating-point field width, precision, alignment, and zero-filling Printing doubles in hexadecimal format Printing optimal field widths for doubles Using format specifiers for strings and characters Using the string field width, precision, alignment, and zero-filling Exploring the sub-string output Using single character formatting Summary
Getting Input from the Command Line
Technical requirements main() The special features of main() The two forms of main() Using argc and argv A simple use of argc and argv Command-line switches and command-line processors Summary
Exploring Formatted Input
Technical requirements Introducing streams Understanding the standard output stream Understanding the standard input stream Exploring the console input with scanf() Reading formatted input with scanf() Reading numerical input with scanf() Reading string and character input with scanf() Using a scan set to limit possible input characters Controlling the scanf() input field width  Using internal data conversion Using sscanf() and sprintf() to convert values into and from strings Converting strings into numbers with atoi() and atod() Using the simple input and output of strings with gets() and puts() Understanding why using gets() could be dangerous Creating a sorted list of names with fgets() and fputs() Summary
Working with Files
Technical requirements Revisiting file streams Understanding the properties of the FILE streams Opening and closing a file Understanding file operations for each type of stream Introducing the filesystem essentials Introducing the filesystem Understanding a file path Understanding a filename Opening files for reading and writing Getting filenames from within the program Getting filenames from the command line  Summary
Using File Input and File Output
Technical requirements File processing Creating a template program to process filenames given on the command line Creating a file of unsorted names Trimming the input string from fgets() Reading names and writing names Reading unsorted names and sorting them for output Using a linked list to sort names Writing names in sorted order Summary
Section 5: Building Blocks for Larger Programs Working with Multi-File Programs
Technical requirements Creating source files Revisiting the preprocessor Understanding the limits and dangers of the preprocessor Knowing some dangers of the preprocessor Using the preprocessor effectively Creating a multi-file program Extracting Card structures and functions Extracting Hand structures and functions Extracting Deck structures and functions Summary
Understanding Scope
Technical requirements Defining scope – visibility, extent, and linkage Exploring visibility Exploring extent Exploring linkage Understanding compilation units Putting visibility, extent, and linkage all together Exploring variable scope Understanding the block scope of variables Understanding function parameter scope Understanding file scope Understanding global scope Understanding function scope Understanding scope and information hiding staticpecifier for functions Summary Epilog Taking the next steps More advanced C topics More advanced programming topics Picking a project for yourself Resources
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 few simple examples Unicode and UTF-8 A brief history A UTF-to-Unicode example The C standard library Method 1 Method 2 Method 3
Other Books You May Enjoy
Leave a review - let other readers know what you think
  • ← Prev
  • Back
  • Next →
  • ← Prev
  • Back
  • Next →

Chief Librarian: Las Zenow <zenow@riseup.net>
Fork the source code from gitlab
.

This is a mirror of the Tor onion service:
http://kx5thpx2olielkihfyo4jgjqfb7zx7wxr3sd4xzt26ochei4m6f7tayd.onion