C Notes for Professionals book

    Amazing collection of free programming books

    收集中
    免费
    Amazing collection of free programming books

    The Notes for Professionals book is compiled from Stack Overflow Documentation, the content is written by the beautiful people at Stack Overflow. Text content is released under Creative Commons BY-SA. See credits at the end of this book whom contributed to the various chapters. Images may be copyright of their respective owners unless otherwise specified

    Book created for educational purposes and is not affiliated with group(s), company(s) nor Stack Overflow. All trademarks belong to their respective company owners

    https://goalkicker.com/

    章节目录

    • 1-1
      Content list
    • 1-2
      About
    • 1-3
      Chapter 1: Getting started with C Language
    • 1-4
      Section 1.1: Hello World
    • 1-5
      Section 1.2: Original "Hello, World!" in K&R C
    • 1-6
      Chapter 2: Comments
    • 1-7
      Section 2.1: Commenting using the preprocessor
    • 1-8
      Section 2.2: /* */ delimited comments
    • 1-9
      Section 2.3: // delimited comments
    • 1-10
      Section 2.4: Possible pitfall due to trigraphs
    • 1-11
      Chapter 3: Data Types
    • 1-12
      Section 3.1: Interpreting Declarations
    • 1-13
      Section 3.2: Fixed Width Integer Types (since C99)
    • 1-14
      Section 3.3: Integer types and constants
    • 1-15
      Section 3.4: Floating Point Constants
    • 1-16
      Section 3.5: String Literals
    • 1-17
      Chapter 4: Operators
    • 1-18
      Section 4.1: Relational Operators
    • 1-19
      Section 4.2: Conditional Operator/Ternary Operator
    • 1-20
      Section 4.3: Bitwise Operators
    • 1-21
      Section 4.4: Short circuit behavior of logical operators
    • 1-22
      Section 4.5: Comma Operator
    • 1-23
      Section 4.6: Arithmetic Operators
    • 1-24
      Section 4.7: Access Operators
    • 1-25
      Section 4.8: sizeof Operator
    • 1-26
      Section 4.9: Cast Operator
    • 1-27
      Section 4.10: Function Call Operator
    • 1-28
      Section 4.11: Increment / Decrement
    • 1-29
      Section 4.12: Assignment Operators
    • 1-30
      Section 4.13: Logical Operators
    • 1-31
      Section 4.14: Pointer Arithmetic
    • 1-32
      Section 4.15: _Alignof
    • 1-33
      Chapter 5: Boolean
    • 1-34
      Section 5.1: Using stdbool.h
    • 1-35
      Section 5.2: Using #define
    • 1-36
      Section 5.3: Using the Intrinsic (built-in) Type _Bool
    • 1-37
      Section 5.4: Integers and pointers in Boolean expressions
    • 1-38
      Section 5.5: Defining a bool type using typedef
    • 1-39
      Chapter 6: Strings
    • 1-40
      Section 6.1: Tokenisation: strtok(), strtok_r() and strtok_s()
    • 1-41
      Section 6.2: String literals
    • 1-42
      Section 6.3: Calculate the Length: strlen()
    • 1-43
      Section 6.4: Basic introduction to strings
    • 1-44
      Section 6.5: Copying strings
    • 1-45
      Section 6.6: Iterating Over the Characters in a String
    • 1-46
      Section 6.7: Creating Arrays of Strings
    • 1-47
      Section 6.8: Convert Strings to Number: atoi(), atof() (dangerous, don't use them)
    • 1-48
      Section 6.9: string formatted data read/write
    • 1-49
      Section 6.10: Find first/last occurrence of a specific character: strchr(), strrchr()
    • 1-50
      Section 6.11: Copy and Concatenation: strcpy(), strcat()
    • 1-51
      Section 6.12: Comparsion: strcmp(), strncmp(), strcasecmp(), strncasecmp()
    • 1-52
      Section 6.13: Safely convert Strings to Number: strtoX functions
    • 1-53
      Section 6.14: strspn and strcspn
    • 1-54
      Chapter 7: Literals for numbers, characters and strings
    • 1-55
      Section 7.1: Floating point literals
    • 1-56
      Section 7.2: String literals
    • 1-57
      Section 7.3: Character literals
    • 1-58
      Section 7.4: Integer literals
    • 1-59
      Chapter 8: Compound Literals
    • 1-60
      Section 8.1: Definition/Initialisation of Compound Literals
    • 1-61
      Chapter 9: Bit-fields
    • 1-62
      Section 9.1: Bit-fields
    • 1-63
      Section 9.2: Using bit-fields as small integers
    • 1-64
      Section 9.3: Bit-field alignment
    • 1-65
      Section 9.4: Don'ts for bit-fields
    • 1-66
      Section 9.5: When are bit-fields useful?
    • 1-67
      Chapter 10: Arrays
    • 1-68
      Section 10.1: Declaring and initializing an array
    • 1-69
      Section 10.2: Iterating through an array eciently and row-major order
    • 1-70
      Section 10.3: Array length
    • 1-71
      Section 10.4: Passing multidimensional arrays to a function
    • 1-72
      Section 10.5: Multi-dimensional arrays
    • 1-73
      Section 10.6: Define array and access array element
    • 1-74
      Section 10.7: Clearing array contents (zeroing)
    • 1-75
      Section 10.8: Setting values in arrays
    • 1-76
      Section 10.9: Allocate and zero-initialize an array with user defined size
    • 1-77
      Section 10.10: Iterating through an array using pointers
    • 1-78
      Chapter 11: Linked lists
    • 1-79
      Section 11.1: A doubly linked list
    • 1-80
      Section 11.2: Reversing a linked list
    • 1-81
      Section 11.3: Inserting a node at the nth position
    • 1-82
      Section 11.4: Inserting a node at the beginning of a singly linked list
    • 1-83
      Chapter 12: Enumerations
    • 1-84
      Section 12.1: Simple Enumeration
    • 1-85
      Section 12.2: enumeration constant without typename
    • 1-86
      Section 12.3: Enumeration with duplicate value
    • 1-87
      Section 12.4: Typedef enum
    • 1-88
      Chapter 13: Structs
    • 1-89
      Section 13.1: Flexible Array Members
    • 1-90
      Section 13.2: Typedef Structs
    • 1-91
      Section 13.3: Pointers to structs
    • 1-92
      Section 13.4: Passing structs to functions
    • 1-93
      Section 13.5: Object-based programming using structs
    • 1-94
      Section 13.6: Simple data structures
    • 1-95
      Chapter 14: Standard Math
    • 1-96
      Section 14.1: Power functions - pow(), powf(), powl()
    • 1-97
      Section 14.2: Double precision floating-point remainder: fmod()
    • 1-98
      Section 14.3: Single precision and long double precision floating-point remainder: fmodf(), fmodl()
    • 1-99
      Chapter 15: Iteration Statements/Loops: for, while, do-while
    • 1-100
      Section 15.1: For loop
    • 1-101
      Section 15.2: Loop Unrolling and Du's Device
    • 1-102
      Section 15.3: While loop
    • 1-103
      Section 15.4: Do-While loop
    • 1-104
      Section 15.5: Structure and flow of control in a for loop
    • 1-105
      Section 15.6: Infinite Loops
    • 1-106
      Chapter 16: Selection Statements
    • 1-107
      Section 16.1: if () Statements
    • 1-108
      Section 16.2: Nested if()...else VS if()..else Ladder
    • 1-109
      Section 16.3: switch () Statements
    • 1-110
      Section 16.4: if () ... else statements and syntax
    • 1-111
      Section 16.5: if()...else Ladder Chaining two or more if () ... else statements
    • 1-112
      Chapter 17: Initialization
    • 1-113
      Section 17.1: Initialization of Variables in C
    • 1-114
      Section 17.2: Using designated initializers
    • 1-115
      Section 17.3: Initializing structures and arrays of structures
    • 1-116
      Chapter 18: Declaration vs Definition
    • 1-117
      Section 18.1: Understanding Declaration and Definition
    • 1-118
      Chapter 19: Command-line arguments
    • 1-119
      Section 19.1: Print the arguments to a program and convert to integer values
    • 1-120
      Section 19.2: Printing the command line arguments
    • 1-121
      Section 19.3: Using GNU getopt tools
    • 1-122
      Chapter 20: Files and I/O streams
    • 1-123
      Section 20.1: Open and write to file
    • 1-124
      Section 20.2: Run process
    • 1-125
      Section 20.3: fprintf
    • 1-126
      Section 20.4: Get lines from a file using getline()
    • 1-127
      Section 20.5: fscanf()
    • 1-128
      Section 20.6: Read lines from a file
    • 1-129
      Section 20.7: Open and write to a binary file
    • 1-130
      Chapter 21: Formatted Input/Output
    • 1-131
      Section 21.1: Conversion Specifiers for printing
    • 1-132
      Section 21.2: The printf() Function
    • 1-133
      Section 21.3: Printing format flags
    • 1-134
      Section 21.4: Printing the Value of a Pointer to an Object
    • 1-135
      Section 21.5: Printing the Dierence of the Values of two Pointers to an Object
    • 1-136
      Section 21.6: Length modifiers
    • 1-137
      Chapter 22: Pointers
    • 1-138
      Section 22.1: Introduction
    • 1-139
      Section 22.2: Common errors
    • 1-140
      Section 22.3: Dereferencing a Pointer
    • 1-141
      Section 22.4: Dereferencing a Pointer to a struct
    • 1-142
      Section 22.5: Const Pointers
    • 1-143
      Section 22.6: Function pointers
    • 1-144
      Section 22.7: Polymorphic behaviour with void pointers
    • 1-145
      Section 22.8: Address-of Operator ( & )
    • 1-146
      Section 22.9: Initializing Pointers
    • 1-147
      Section 22.10: Pointer to Pointer
    • 1-148
      Section 22.11: void* pointers as arguments and return values to standard functions
    • 1-149
      Section 22.12: Same Asterisk, Dierent Meanings
    • 1-150
      Chapter 23: Sequence points
    • 1-151
      Section 23.1: Unsequenced expressions
    • 1-152
      Section 23.2: Sequenced expressions
    • 1-153
      Section 23.3: Indeterminately sequenced expressions
    • 1-154
      Chapter 24: Function Pointers
    • 1-155
      Section 24.1: Introduction
    • 1-156
      Section 24.2: Returning Function Pointers from a Function
    • 1-157
      Section 24.3: Best Practices
    • 1-158
      Section 24.4: Assigning a Function Pointer
    • 1-159
      Section 24.5: Mnemonic for writing function pointers
    • 1-160
      Section 24.6: Basics
    • 1-161
      Chapter 25: Function Parameters
    • 1-162
      Section 25.1: Parameters are passed by value
    • 1-163
      Section 25.2: Passing in Arrays to Functions
    • 1-164
      Section 25.3: Order of function parameter execution
    • 1-165
      Section 25.4: Using pointer parameters to return multiple values
    • 1-166
      Section 25.5: Example of function returning struct containing values with error codes
    • 1-167
      Chapter 26: Pass 2D-arrays to functions
    • 1-168
      Section 26.1: Pass a 2D-array to a function
    • 1-169
      Section 26.2: Using flat arrays as 2D arrays
    • 1-170
      Chapter 27: Error handling
    • 1-171
      Section 27.1: errno
    • 1-172
      Section 27.2: strerror
    • 1-173
      Section 27.3: perror
    • 1-174
      Chapter 28: Undefined behavior
    • 1-175
      Section 28.1: Dereferencing a pointer to variable beyond its lifetime
    • 1-176
      Section 28.2: Copying overlapping memory
    • 1-177
      Section 28.3: Signed integer overflow
    • 1-178
      Section 28.4: Use of an uninitialized variable
    • 1-179
      Section 28.5: Data race
    • 1-180
      Section 28.6: Read value of pointer that was freed
    • 1-181
      Section 28.7: Using incorrect format specifier in printf
    • 1-182
      Section 28.8: Modify string literal
    • 1-183
      Section 28.9: Passing a null pointer to printf %s conversion
    • 1-184
      Section 28.10: Modifying any object more than once between two sequence points
    • 1-185
      Section 28.11: Freeing memory twice
    • 1-186
      Section 28.12: Bit shifting using negative counts or beyond the width of the type
    • 1-187
      Section 28.13: Returning from a function that's declared with `_Noreturn` or `noreturn` function specifier
    • 1-188
      Section 28.14: Accessing memory beyond allocated chunk
    • 1-189
      Section 28.15: Modifying a const variable using a pointer
    • 1-190
      Section 28.16: Reading an uninitialized object that is not backed by memory
    • 1-191
      Section 28.17: Addition or subtraction of pointer not properly bounded
    • 1-192
      Section 28.18: Dereferencing a null pointer
    • 1-193
      Section 28.19: Using ush on an input stream
    • 1-194
      Section 28.20: Inconsistent linkage of identifiers
    • 1-195
      Section 28.21: Missing return statement in value returning function
    • 1-196
      Section 28.22: Division by zero
    • 1-197
      Section 28.23: Conversion between pointer types produces incorrectly aligned result
    • 1-198
      Section 28.24: Modifying the string returned by getenv, strerror, and setlocale functions
    • 1-199
      Chapter 29: Random Number Generation
    • 1-200
      Section 29.1: Basic Random Number Generation
    • 1-201
      Section 29.2: Permuted Congruential Generator
    • 1-202
      Section 29.3: Xorshift Generation
    • 1-203
      Section 29.4: Restrict generation to a given range
    • 1-204
      Chapter 30: Preprocessor and Macros
    • 1-205
      Section 30.1: Header Include Guards
    • 1-206
      Section 30.2: #if 0 to block out code sections
    • 1-207
      Section 30.3: Function-like macros
    • 1-208
      Section 30.4: Source file inclusion
    • 1-209
      Section 30.5: Conditional inclusion and conditional function signature modification
    • 1-210
      Section 30.6: __cplusplus for using C externals in C++ code compiled with C++ - name mangling
    • 1-211
      Section 30.7: Token pasting
    • 1-212
      Section 30.8: Predefined Macros
    • 1-213
      Section 30.9: Variadic arguments macro
    • 1-214
      Section 30.10: Macro Replacement
    • 1-215
      Section 30.11: Error directive
    • 1-216
      Section 30.12: FOREACH implementation
    • 1-217
      Chapter 31: Signal handling
    • 1-218
      Section 31.1: Signal Handling with “signal()”
    • 1-219
      Chapter 32: Variable arguments
    • 1-220
      Section 32.1: Using an explicit count argument to determine the length of the va_list
    • 1-221
      Section 32.2: Using terminator values to determine the end of va_list
    • 1-222
      Section 32.3: Implementing functions with a `printf()`-like interface
    • 1-223
      Section 32.4: Using a format string
    • 1-224
      Chapter 33: Assertion
    • 1-225
      Section 33.1: Simple Assertion
    • 1-226
      Section 33.2: Static Assertion
    • 1-227
      Section 33.3: Assert Error Messages
    • 1-228
      Section 33.4: Assertion of Unreachable Code
    • 1-229
      Section 33.5: Precondition and Postcondition
    • 1-230
      Chapter 34: Generic selection
    • 1-231
      Section 34.1: Check whether a variable is of a certain qualified type
    • 1-232
      Section 34.2: Generic selection based on multiple arguments
    • 1-233
      Section 34.3: Type-generic printing macro
    • 1-234
      Chapter 35: X-macros
    • 1-235
      Section 35.1: Trivial use of X-macros for printfs
    • 1-236
      Section 35.2: Extension: Give the X macro as an argument
    • 1-237
      Section 35.3: Enum Value and Identifier
    • 1-238
      Section 35.4: Code generation
    • 1-239
      Chapter 36: Aliasing and eective type
    • 1-240
      Section 36.1: Eective type
    • 1-241
      Section 36.2: restrict qualification
    • 1-242
      Section 36.3: Changing bytes
    • 1-243
      Section 36.4: Character types cannot be accessed through non-character types
    • 1-244
      Section 36.5: Violating the strict aliasing rules
    • 1-245
      Chapter 37: Compilation
    • 1-246
      Section 37.1: The Compiler
    • 1-247
      Section 37.2: File Types
    • 1-248
      Section 37.3: The Linker
    • 1-249
      Section 37.4: The Preprocessor
    • 1-250
      Section 37.5: The Translation Phases
    • 1-251
      Chapter 38: Inline assembly
    • 1-252
      Section 38.1: gcc Inline assembly in macros
    • 1-253
      Section 38.2: gcc Basic asm support
    • 1-254
      Section 38.3: gcc Extended asm support
    • 1-255
      Chapter 39: Identifier Scope
    • 1-256
      Section 39.1: Function Prototype Scope
    • 1-257
      Section 39.2: Block Scope
    • 1-258
      Section 39.3: File Scope
    • 1-259
      Section 39.4: Function scope
    • 1-260
      Chapter 40: Implicit and Explicit Conversions
    • 1-261
      Section 40.1: Integer Conversions in Function Calls
    • 1-262
      Section 40.2: Pointer Conversions in Function Calls
    • 1-263
      Chapter 41: Type Qualifiers
    • 1-264
      Section 41.1: Volatile variables
    • 1-265
      Section 41.2: Unmodifiable (const) variables
    • 1-266
      Chapter 42: Typedef
    • 1-267
      Section 42.1: Typedef for Structures and Unions
    • 1-268
      Section 42.2: Typedef for Function Pointers
    • 1-269
      Section 42.3: Simple Uses of Typedef
    • 1-270
      Chapter 43: Storage Classes
    • 1-271
      Section 43.1: auto
    • 1-272
      Section 43.2: register
    • 1-273
      Section 43.3: static
    • 1-274
      Section 43.4: typedef
    • 1-275
      Section 43.5: extern
    • 1-276
      Section 43.6: _Thread_local
    • 1-277
      Chapter 44: Declarations
    • 1-278
      Section 44.1: Calling a function from another C file
    • 1-279
      Section 44.2: Using a Global Variable
    • 1-280
      Section 44.3: Introduction
    • 1-281
      Section 44.4: Typedef
    • 1-282
      Section 44.5: Using Global Constants
    • 1-283
      Section 44.6: Using the right-left or spiral rule to decipher C declaration
    • 1-284
      Chapter 45: Structure Padding and Packing
    • 1-285
      Section 45.1: Packing structures
    • 1-286
      Section 45.2: Structure padding
    • 1-287
      Chapter 46: Memory management
    • 1-288
      Section 46.1: Allocating Memory
    • 1-289
      Section 46.2: Freeing Memory
    • 1-290
      Section 46.3: Reallocating Memory
    • 1-291
      Section 46.4: realloc(ptr, 0) is not equivalent to free(ptr)
    • 1-292
      Section 46.5: Multidimensional arrays of variable size
    • 1-293
      Section 46.6: alloca: allocate memory on stack
    • 1-294
      Section 46.7: User-defined memory management
    • 1-295
      Chapter 47: Implementation-defined behaviour
    • 1-296
      Section 47.1: Right shift of a negative integer
    • 1-297
      Section 47.2: Assigning an out-of-range value to an integer
    • 1-298
      Section 47.3: Allocating zero bytes
    • 1-299
      Section 47.4: Representation of signed integers
    • 1-300
      Chapter 48: Atomics
    • 1-301
      Section 48.1: atomics and operators
    • 1-302
      Chapter 49: Jump Statements
    • 1-303
      Section 49.1: Using return
    • 1-304
      Section 49.2: Using goto to jump out of nested loops
    • 1-305
      Section 49.3: Using break and continue
    • 1-306
      Chapter 50: Create and include header files
    • 1-307
      Section 50.1: Introduction
    • 1-308
      Section 50.2: Self-containment
    • 1-309
      Section 50.3: Minimality
    • 1-310
      Section 50.4: Notation and Miscellany
    • 1-311
      Section 50.5: Idempotence
    • 1-312
      Section 50.6: Include What You Use (IWYU)
    • 1-313
      Chapter 51: <ctype.h> — character classification & conversion
    • 1-314
      Section 51.1: Introduction
    • 1-315
      Section 51.2: Classifying characters read from a stream
    • 1-316
      Section 51.3: Classifying characters from a string
    • 1-317
      Chapter 52: Side Eects
    • 1-318
      Section 52.1: Pre/Post Increment/Decrement operators
    • 1-319
      Chapter 53: Multi-Character Character Sequence
    • 1-320
      Section 53.1: Trigraphs
    • 1-321
      Section 53.2: Digraphs
    • 1-322
      Chapter 54: Constraints
    • 1-323
      Section 54.1: Duplicate variable names in the same scope
    • 1-324
      Section 54.2: Unary arithmetic operators
    • 1-325
      Chapter 55: Inlining
    • 1-326
      Section 55.1: Inlining functions used in more than one source file
    • 1-327
      Chapter 56: Unions
    • 1-328
      Section 56.1: Using unions to reinterpret values
    • 1-329
      Section 56.2: Writing to one union member and reading from another
    • 1-330
      Section 56.3: Dierence between struct and union
    • 1-331
      Chapter 57: Threads (native)
    • 1-332
      Section 57.1: Inititialization by one thread
    • 1-333
      Section 57.2: Start several threads
    • 1-334
      Chapter 58: Multithreading
    • 1-335
      Section 58.1: C11 Threads simple example
    • 1-336
      Chapter 59: Interprocess Communication (IPC)
    • 1-337
      Section 59.1: Semaphores
    • 1-338
      Chapter 60: Testing frameworks
    • 1-339
      Section 60.1: Unity Test Framework
    • 1-340
      Section 60.2: CMocka
    • 1-341
      Section 60.3: CppUTest
    • 1-342
      Chapter 61: Valgrind
    • 1-343
      Section 61.1: Bytes lost -- Forgetting to free
    • 1-344
      Section 61.2: Most common errors encountered while using Valgrind
    • 1-345
      Section 61.3: Running Valgrind
    • 1-346
      Section 61.4: Adding flags
    • 1-347
      Chapter 62: Common C programming idioms and developer practices
    • 1-348
      Section 62.1: Comparing literal and variable
    • 1-349
      Section 62.2: Do not leave the parameter list of a function blank — use void
    • 1-350
      Chapter 63: Common pitfalls
    • 1-351
      Section 63.1: Mixing signed and unsigned integers in arithmetic operations
    • 1-352
      Section 63.2: Macros are simple string replacements
    • 1-353
      Section 63.3: Forgetting to copy the return value of realloc into a temporary
    • 1-354
      Section 63.4: Forgetting to allocate one extra byte for \0
    • 1-355
      Section 63.5: Misunderstanding array decay
    • 1-356
      Section 63.6: Forgetting to free memory (memory leaks)
    • 1-357
      Section 63.7: Copying too much
    • 1-358
      Section 63.8: Mistakenly writing = instead of == when comparing
    • 1-359
      Section 63.9: Newline character is not consumed in typical scanf() call
    • 1-360
      Section 63.10: Adding a semicolon to a #define
    • 1-361
      Section 63.11: Incautious use of semicolons
    • 1-362
      Section 63.12: Undefined reference errors when linking
    • 1-363
      Section 63.13: Checking logical expression against 'true'
    • 1-364
      Section 63.14: Doing extra scaling in pointer arithmetic
    • 1-365
      Section 63.15: Multi-line comments cannot be nested
    • 1-366
      Section 63.16: Ignoring return values of library functions
    • 1-367
      Section 63.17: Comparing floating point numbers
    • 1-368
      Section 63.18: Floating point literals are of type double by default
    • 1-369
      Section 63.19: Using character constants instead of string literals, and vice versa
    • 1-370
      Section 63.20: Recursive function — missing out the base condition
    • 1-371
      Section 63.21: Overstepping array boundaries
    • 1-372
      Section 63.22: Passing unadjacent arrays to functions expecting "real" multidimensional arrays
    • 1-373
      Credits
    • 1-374
      You may also like

    常见问答

    您可以透過手機、平板或是電腦登入 HiSKIO 平台,在【我的學習】>【我的書籍】頁面,選擇想看的電子書。

    猜你喜欢

    用户评价

    | 收集中

    销售方案