Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C

modules and boundaries — concept C23

C23 still organizes programs mainly with headers and separately translated source files: a header exposes declarations and one unit provides each externally linked definition. Include guards prevent repeated content, `static` hides implementation details, and incompatible declarations across units violate the contract.

Version: C23

Syntax

modules and boundaries

C23 still organizes programs mainly with headers and separately translated source files: a header exposes declarations and one unit provides each externally linked definition. Include guards prevent repeated content, static hides implementation details, and incompatible declarations across units violate the contract.

A real boundary consists of counter.h declarations, counter.c definitions, and a client file including the header; compile them separately and then link them. An opaque type plus accessor functions hides fields, while static keeps a helper symbol inside the implementation unit.

The displayed package example is intentionally single-file because the shared runner compiles one file; it demonstrates only static internal linkage, not full module linking. In a project, check header guards, exactly one definition of each external symbol, and compatible compiler options for every unit.

Examples

#include <stdio.h>

static int private_value(void) { return 7; }
int main(void) { printf("%d\n", private_value()); return 0; }

Result

7

C23 still organizes programs mainly with headers and separately translated source files: a header exposes declarations and one unit provides each externally linked definition. Include guards prevent repeated content, `static` hides implementation details, and incompatible declarations across units violate the contract.

Sources