Storage-class specifiers

Specify storage duration and linkage of objects and functions: 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) extern - static duration and external linkage (unless already declared internal) _Thread_local - thread storage duration (since C11) Explanation Storage-class specifiers appear in declarations. At most one specifier may

while loop

Executes a statement repeatedly, until the value of expression becomes equal to zero. The test takes place before each iteration. Syntax while ( expression ) statement expression - any expression of scalar type. This expression is evaluated before each iteration, and if it compares equal to zero, the loop is exited. statement - any statement, typically a compound statement, which serves as the body of the loop Explanation A while statement causes the statement (also

remove

Defined in header <stdio.h> int remove( const char *fname ); Deletes the file identified by character string pointed to by fname. If the file is currently open by this or another process, the behavior of this function is implementation-defined (in particular, POSIX systems unlink the file name although the file system space is not reclaimed until the last running process closes the file; Windows does not allow the file to be deleted). Parameters fname - pointer to a

int

Usage int type: as the declaration of the type

putchar

Defined in header <stdio.h> int putchar( int ch ); Writes a character ch to stdout. Internally, the character is converted to unsigned char just before being written. Equivalent to putc(ch, stdout). Parameters ch - character to be written Return value On success, returns the written character. On failure, returns EOF and sets the error indicator (see ferror()) on stdout. Example putchar with error checking. #include <stdio.h> #include <stdlib.h>

offsetof

Defined in header <stddef.h> #define offsetof(type, member) /*implementation-defined*/ The macro offsetof expands to a constant of type size_t, the value of which is the offset, in bytes, from the beginning of an object of specified type to its specified member, including padding if any. Example #include <stdio.h> #include <stddef.h> struct S { char c; double d; }; int main(void) { printf("the first element is at offset %zu\n", offsetof(stru

localeconv

Defined in header <locale.h> lconv* localeconv(); The localeconv function obtains a pointer to a static object of type lconv, which represents numeric and monetary formatting rules of the current C locale. Parameters (none). Return value pointer to the current lconv object. Notes Modifying the object references through the returned pointer is undefined behavior. localeconv modifies a static object, calling it from different threads without synchronization is undefi

max_align_t

Defined in header <stddef.h> typedef /*implementation-defined*/ max_align_t; (since C11) max_align_t is a type whose alignment requirement is at least as strict (as large) as that of every scalar type. Notes Pointers returned by allocation functions such as malloc are suitably aligned for any object, which means they are aligned at least as strict as max_align_t. max_align_t is usually synonymous with the largest scalar type, which is long double on most platforms, and i

kill_dependency

Defined in header <stdatomic.h> A kill_dependency(A y); (since C11) Informs the compiler that the dependency tree started by an memory_order_consume atomic load operation does not extend past the return value of kill_dependency; that is, the argument does not carry a dependency into the return value. The function is implemented as a macro. A is the type of y. Parameters y - the expression whose return value is to be removed from a dependency tree Return value

tss_get

Defined in header <threads.h> void *tss_get( tss_t tss_key ); (since C11) Returns the value held in thread-specific storage for the current thread identified by tss_key. Different threads may get different values identified by the same key. On thread startup (see thrd_create), the values associated with all TSS keys are NULL. Different value may be placed in the thread-specific storage with tss_set. Parameters tss_key - thread-specific storage key, obtained from tss