Keywords

https://en.cppreference.com/w/c/keyword

Storage-class specifiers

  • auto: automatic duration and no linkage

  • register: automatic duration and no linkage; address of this variable cannot be taken

  • static: static duration and internal linkage (unless at block scope) static duration and internal linkage, a function declared as static at the top level of a source file (outside any class definitions) – is only visible throughout that file (”file scope”, also known as “internal linkage”). A variable declared as static at the top level of a source file (outside any function definitions) is only visible throughout that file

  • extern: static duration and external linkage (unless already declared internal)

    Static storage and external linkage

If no storage-class specifier is provided, the defaults are:

  • extern for all functions

  • extern for objects at file scope

  • auto for objects at block scope

C Type qualifier

  • volatile: disable optimization: within a single thread of execution, a volatile access cannot be optimized out or reordered relative to another visible side effect that is separated by a sequence point from the volatile access.

  • const: Objects declared with const-qualified types may be placed in read-only memory by the compiler, and if the address of a const object is never taken in a program, it may not be stored at all.

  • restrict: applies Only a pointer to an object type or an array thereof (since C23). Promotes optimization by retricting modification of memory through multiple pointers

Other keyords

  • inline: replace function call with its body for code optimization