functions
[[nodiscard]] static int add(int a, int b) {
return a + b;
}
[[nodiscard]] is a C23 attribute
It warns when a caller ignores the result
Prototypes
C23 removed old style function declarations without prototypes Write the full signature before use The compiler can then check argument types and count
Headers
Declarations go in headers
Definitions go in source files
Include guards or #pragma once stop double inclusion
static
static at file scope limits visibility to that translation unit
static on a local variable gives it static storage duration
Two meanings, same keyword, context decides
Recursion
Every recursive call consumes stack C does not guarantee tail call elimination Prefer iteration for deep or unbounded work
Next
Arrays and strings in 06 arrays and strings
Posted