Learn C the Hard Way
Exercises and notes from the book "Learn C the Hard Way", by Zed Shaw
Ex1: Dust Off That Compiler
Ex3: Formatted Printing
Ex4: Using a Debugger
This exercise requires that the accompanying video is watched
Ex7: Variables and Types
Ex8: If, Else-If, Else
Ex9: While-loop and Boolean Expressions
Ex10: Switch Statements
Ex11: Arrays and Strings
Ex12: Sizes and Arrays
Ex13: For-Loops and Array of Strings
Ex14: Writing and Using Functions
Ex15: Pointers, dreaded pointers
Pointers Lexicon:
type *ptr
: A pointer of type named ptr*ptr
: The value of whateverptr
is pointed at*(ptr + i)
: The value of whateverptr
is pointed at plusi
&thing
: The address ofthing
type *ptr = &thing
: A pointer oftype
namedptr
set to the address ofthing
ptr++
: increment to whereptr
points
Ex16: Structs and pointers to them
Aditional pointers Lexicon:
ptr->elem
: Use pointer to struct/union to getelem
Use an ->
when you have a pointer to a struct