Types and expressions

This part of the C course is about the values a program works with: the integer widths and the limits in limits.h, the binary fractions of a floating-point number, and the operators that combine them. It shows how a value converts and when a cast truncates it, what a format string of printf and scanf really reads and writes, and closes with the bit operations that pack several flags into one integer.

2.1 Integers, widths and limits limits.h, unsigned wrap, signed overflow, inttypes.h Open 2.2 Floating-point numbers binary fractions, epsilon, formatting, inf and nan Open 2.3 Operators and precedence arithmetic, modulo, increment, short-circuit, comparisons Open 2.4 Conversions and casts promotion, narrowing, signed to unsigned, float to int Open 2.5 Formatted input and output printf widths, scanf results, fgets, the newline trap Open 2.6 Bit manipulation shifts, masks, flags, popcount, hex printing Open

Lessons