Beej's Guide to C Programming
Brian "Beej" Hall
beej@beej.us
Revision alpha-25
May 17, 2007
Copyright © 2007 Brian "Beej" Hall
Contents
- 1. Foreward
- 1.1. Audience
- 1.2. Platform and Compiler
- 1.3. Building under Unix
- 1.4. Official Homepage
- 1.5. Email Policy
- 1.6. Mirroring
- 1.7. Note for Translators
- 1.8. Copyright and Distribution
- 2. Programming Building Blocks
- 2.1. The Specification
- 2.2. The Implementation
- 2.3. So Much To Do, So Little Time
- 2.4. Hello, World!
- 3. Variables, Expressions, and Statements (Oh My)
- 3.1. Variables
- 3.2. Operators
- 3.3. Expressions
- 3.4. Statements
- 4. Building Blocks Revisited
- 5. Functions
- 5.1. Passing by Value
- 5.2. Function Prototypes
- 6. Variables, The Sequel
- 6.1. "Up Scope"
- 6.2. Storage Classes
- 7. Pointers--Cower In Fear!
- 7.1. Memory and Variables
- 7.2. Pointer Types
- 7.3. Dereferencing
- 7.4. Passing Pointers as Parameters
- 8. Structures
- 8.1. Pointers to structs
- 8.2. Passing struct pointers to functions
- 9. Arrays
- 9.1. Passing arrays to functions
- 10. Strings
- 11. Dynamic Memory
- 11.1. malloc()
- 11.2. free()
- 11.3. realloc()
- 11.4. calloc()
- 12. More Stuff!
- 12.1. Pointer Arithmetic
- 12.2. typedef
- 12.3. enum
- 12.4. More struct declarations
- 12.5. Command Line Arguments
- 12.6. Multidimensional Arrays
- 12.7. Casting and promotion
- 12.8. Incomplete types
- 12.9. void pointers
- 12.10. NULL pointers
- 12.11. More Static
- 12.12. Typical Multifile Projects
- 12.13. The Almighty C Preprocessor
- 12.14. Pointers to pointers
- 12.15. Pointers to Functions
- 12.16. Variable Argument Lists
- 13. Standard I/O Library
- 13.1. fopen()
- 13.2. freopen()
- 13.3. fclose()
- 13.4. printf(), fprintf()
- 13.5. scanf(), fscanf()
- 13.6. gets(), fgets()
- 13.7. getc(), fgetc(), getchar()
- 13.8. puts(), fputs()
- 13.9. putc(), fputc(), putchar()
- 13.10. fseek(), rewind()
- 13.11. ftell()
- 13.12. fgetpos(), fsetpos()
- 13.13. ungetc()
- 13.14. fread()
- 13.15. fwrite()
- 13.16. feof(), ferror(),
clearerr()
- 13.17. perror()
- 13.18. remove()
- 13.19. rename()
- 13.20. tmpfile()
- 13.21. tmpnam()
- 13.22. setbuf(), setvbuf()
- 13.23. fflush()
- 14. String Manipulation
- 14.1. strlen()
- 14.2. strcmp(), strncmp()
- 14.3. strcat(), strncat()
- 14.4. strchr(), strrchr()
- 14.5. strcpy(), strncpy()
- 14.6. strspn(), strcspn()
- 14.7. strstr()
- 14.8. strtok()
- 15. Mathematics
- 15.1. sin(), sinf(), sinl()
- 15.2. cos(), cosf(), cosl()
- 15.3. tan(), tanf(), tanl()
- 15.4. asin(), asinf(), asinl()
- 15.5. acos(), acosf(), acosl()
- 15.6. atan(), atanf(), atanl(),
atan2(), atan2f(), atan2l()
- 15.7. sqrt()
- 16. Complex Numbers
- 17. Time Library