Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C

type system — concept C23

The C type system distinguishes compatible types, qualifiers, and an object’s effective type; incompatible pointer access can violate aliasing, and `const` restricts modification through that lvalue rather than always making storage immutable.

Version: C23

Syntax

type system

The C type system distinguishes compatible types, qualifiers, and an object’s effective type; incompatible pointer access can violate aliasing, and const restricts modification through that lvalue rather than always making storage immutable.

Let an interface express immutability with const, separate opaque handles from their representation, and use compatible declarations in every translation unit. For generic data, pass void * with a separate type or size and restore the correct aligned type before access.

const int * and int * const qualify different parts of a declaration; casting away const and modifying an originally constant object is undefined. Storage from malloc acquires an effective type through writes, and reading through an incompatible type can violate aliasing despite a matching size.

Examples

#include <stdio.h>

int main(void) { const int value = 7; const int *pointer = &value; printf("%d\n", *pointer); return 0; }

Result

7

The C type system distinguishes compatible types, qualifiers, and an object’s effective type; incompatible pointer access can violate aliasing, and `const` restricts modification through that lvalue rather than always making storage immutable.

Sources