Download Learn C the Hard Way PDF

TitleLearn C the Hard Way
File Size23.5 MB
Total Pages590
Table of Contents
                            About This eBook
Title Page
Copyright Page
Contents
Acknowledgments
This Book Is Not Really about C
	The Undefined Behaviorists
	C Is a Pretty and Ugly Language
	What You Will Learn
	How to Read This Book
	The Videos
	The Core Competencies
		Reading and Writing
		Attention to Detail
		Spotting Differences
		Planning and Debugging
Exercise 0. The Setup
	Linux
	Mac OS X
	Windows
	Text Editor
		Do Not Use an IDE
Exercise 1. Dust Off That Compiler
	Breaking It Down
	What You Should See
	How to Break It
	Extra Credit
Exercise 2. Using Makefiles to Build
	Using Make
	What You Should See
	How to Break It
	Extra Credit
Exercise 3. Formatted Printing
	What You Should See
	External Research
	How to Break It
	Extra Credit
Exercise 4. Using a Debugger
	GDB Tricks
	GDB Quick Reference
	LLDB Quick Reference
Exercise 5. Memorizing C Operators
	How to Memorize
	The List of Operators
Exercise 6. Memorizing C Syntax
	The Keywords
	Syntax Structures
	A Word of Encouragement
	A Word of Warning
Exercise 7. Variables and Types
	What You Should See
	How to Break It
	Extra Credit
Exercise 8. If, Else-If, Else
	What You Should See
	How to Break It
	Extra Credit
Exercise 9. While-Loop and Boolean Expressions
	What You Should See
	How to Break It
	Extra Credit
Exercise 10. Switch Statements
	What You Should See
	How to Break It
	Extra Credit
Exercise 11. Arrays and Strings
	What You Should See
	How to Break It
	Extra Credit
Exercise 12. Sizes and Arrays
	What You Should See
	How to Break It
	Extra Credit
Exercise 13. For-Loops and Arrays of Strings
	What You Should See
	Understanding Arrays of Strings
	How to Break It
	Extra Credit
Exercise 14. Writing and Using Functions
	What You Should See
	How to Break It
	Extra Credit
Exercise 15. Pointers, Dreaded Pointers
	What You Should See
	Explaining Pointers
	Practical Pointer Usage
	The Pointer Lexicon
	Pointers Aren’t Arrays
	How to Break It
	Extra Credit
Exercise 16. Structs And Pointers to Them
	What You Should See
	Explaining Structures
	How to Break It
	Extra Credit
Exercise 17. Heap and Stack Memory Allocation
	What You Should See
	Heap versus Stack Allocation
	How to Break It
	Extra Credit
Exercise 18. Pointers to Functions
	What You Should See
	How to Break It
	Extra Credit
Exercise 19. Zed’s Awesome Debug Macros
	The C Error-Handling Problem
	The Debug Macros
	Using dbg.h
	What You Should See
	How the CPP Expands Macros
	Extra Credit
Exercise 20. Advanced Debugging Techniques
	Debug Printing versus GDB
	A Debugging Strategy
	Extra Credit
Exercise 21. Advanced Data Types and Flow Control
	Available Data Types
		Type Modifiers
		Type Qualifiers
		Type Conversion
		Type Sizes
	Available Operators
		Math Operators
		Data Operators
		Logic Operators
		Bit Operators
		Boolean Operators
		Assignment Operators
	Available Control Structures
	Extra Credit
Exercise 22. The Stack, Scope, and Globals
	ex22.h and ex22.c
	ex22_main.c
	What You Should See
	Scope, Stack, and Bugs
	How to Break It
	Extra Credit
Exercise 23. Meet Duff’s Device
	What You Should See
	Solving the Puzzle
		Why Bother?
	Extra Credit
Exercise 24. Input, Output, Files
	What You Should See
	How to Break It
	The I/O Functions
	Extra Credit
Exercise 25. Variable Argument Functions
	What You Should See
	How to Break It
	Extra Credit
Exercise 26. Project logfind
	The logfind Specification
Exercise 27. Creative and Defensive Programming
	The Creative Programmer Mind-Set
	The Defensive Programmer Mind-Set
	The Eight Defensive Programmer Strategies
	Applying the Eight Strategies
		Never Trust Input
		Prevent Errors
		Fail Early and Openly
		Document Assumptions
		Prevention over Documentation
		Automate Everything
		Simplify and Clarify
		Question Authority
	Order Is Not Important
	Extra Credit
Exercise 28. Intermediate Makefiles
	The Basic Project Structure
	Makefile
		The Header
		The Target Build
		The Unit Tests
		The Cleaner
		The Install
		The Checker
	What You Should See
	Extra Credit
Exercise 29. Libraries and Linking
	Dynamically Loading a Shared Library
	What You Should See
	How to Break It
	Extra Credit
Exercise 30. Automated Testing
	Wiring Up the Test Framework
	Extra Credit
Exercise 31. Common Undefined Behavior
	UB 20
		Common UBs
Exercise 32. Double Linked Lists
	What Are Data Structures
	Making the Library
	Doubly Linked Lists
		Definition
		Implementation
	Tests
	What You Should See
	How to Improve It
	Extra Credit
Exercise 33. Linked List Algorithms
	Bubble and Merge Sorts
	The Unit Test
	The Implementation
	What You Should See
	How to Improve It
	Extra Credit
Exercise 34. Dynamic Array
	Advantages and Disadvantages
	How to Improve It
	Extra Credit
Exercise 35. Sorting and Searching
	Radix Sort and Binary Search
		C Unions
		The Implementation
		RadixMap_find and Binary Search
		RadixMap_sort and radix_sort
	How to Improve It
	Extra Credit
Exercise 36. Safer Strings
	Why C Strings Were a Horrible Idea
	Using bstrlib
	Learning the Library
Exercise 37. Hashmaps
	The Unit Test
	How to Improve It
	Extra Credit
Exercise 38. Hashmap Algorithms
	What You Should See
	How to Break It
	Extra Credit
Exercise 39. String Algorithms
	What You Should See
	Analyzing the Results
	Extra Credit
Exercise 40. Binary Search Trees
	How to Improve It
	Extra Credit
Exercise 41. Project devpkg
	What Is devpkg?
		What We Want to Make
		The Design
		The Apache Portable Runtime
	Project Layout
		Other Dependencies
	The Makefile
	The Source Files
		The DB Functions
		The Shell Functions
		The Command Functions
		The devpkg Main Function
	The Final Challenge
Exercise 42. Stacks and Queues
	What You Should See
	How to Improve It
	Extra Credit
Exercise 43. A Simple Statistics Engine
	Rolling Standard Deviation and Mean
	Implementation
	How to Use It
	Extra Credit
Exercise 44. Ring Buffer
	The Unit Test
	What You Should See
	How to Improve It
	Extra Credit
Exercise 45. A Simple TCP/IP Client
	Augment the Makefile
	The netclient Code
	What You Should See
	How to Break It
	Extra Credit
Exercise 46. Ternary Search Tree
	Advantages and Disadvantages
	How to Improve It
	Extra Credit
Exercise 47. A Fast URL Router
	What You Should See
	How to Improve It
	Extra Credit
Exercise 48. A Simple Network Server
	The Specification
Exercise 49. A Statistics Server
	Specification
Exercise 50. Routing the Statistics
Exercise 51. Storing the Statistics
	The Specification
Exercise 52. Hacking and Improving Your Server
Next Steps
Index
Where are the Companion Content Files?
Code Snippets
                        

Similer Documents