Category Archives: C Programming

Chapter 33: Assertion

Parameter                                       Details expression expression of scalar type. message    string literal to be included in the diagnostic message. An assertion is a predicate that…
Continue reading

Chapter 32: Variable arguments

Parameter                                                                             Details Variable arguments are used by functions in the printf family (printf, fprintf, etc) and others to allow a function to be…
Continue reading

Chapter 31: Signal handling

Parameter                                                                             Details Section 31.1: Signal Handling with “signal()” Signal numbers can be synchronous (like SIGSEGV – segmentation fault) when they are triggered by…
Continue reading

Chapter 30: Preprocessor and Macros

All preprocessor commands begins with the hash (pound) symbol #. A C macro is just a preprocessor command that is defined using the…
Continue reading

Chapter 29: Random Number Generation

Section 29.1: Basic Random Number Generation The function rand() can be used to generate a pseudo-random integer value between 0 and RAND_MAX (0 and RAND_MAX…
Continue reading

Chapter 28: Undefined behavior

In C, some expressions yield undefined behavior. The standard explicitly chooses to not define how a compiler should behave if it encounters such…
Continue reading

Chapter 27: Error handling

Section 27.1: errno When a standard library function fails, it often sets errno to the appropriate error code. The C standard requires at…
Continue reading

Chapter 26: Pass 2D-arrays to functions

Section 26.1: Pass a 2D-array to a function Passing a 2d array to a functions seems simple and obvious and we happily write:…
Continue reading

Chapter 25: Function Parameters

Section 25.1: Parameters are passed by value In C, all function parameters are passed by value, so modifying what is passed in callee…
Continue reading

Chapter 24: Function Pointers

Function pointers are pointers that point to functions instead of data types. They can be used to allow variability in the function that…
Continue reading