Tutorial by Examples

Defines a new type based on an existing type. Its syntax mirrors that of a variable declaration. /* Byte can be used wherever `unsigned char` is needed */ typedef unsigned char Byte; /* Integer is the type used to declare an array consisting of a single int */ typedef int Integer[1]; /* Nod...
This storage class denotes that an identifier has automatic storage duration. This means once the scope in which the identifier was defined ends, the object denoted by the identifier is no longer valid. Since all objects, not living in global scope or being declared static, have automatic storage d...
The static storage class serves different purposes, depending on the location of the declaration in the file: To confine the identifier to that translation unit only (scope=file). /* No other translation unit can use this variable. */ static int i; /* Same; static is attached to the functi...
Used to declare an object or function that is defined elsewhere (and that has external linkage). In general, it is used to declare an object or function to be used in a module that is not the one in which the corresponding object or function is defined: /* file1.c */ int foo = 2; /* Has externa...
Hints to the compiler that access to an object should be as fast as possible. Whether the compiler actually uses the hint is implementation-defined; it may simply treat it as equivalent to auto. The only property that is definitively different for all objects that are declared with register is that...
C11 This was a new storage specifier introduced in C11 along with multi-threading. This isn't available in earlier C standards. Denotes thread storage duration. A variable declared with _Thread_local storage specifier denotes that the object is local to that thread and its lifetime is the entire e...

Page 1 of 1