sizeof operator

Queries size of the object or type. Used when actual size of the object must be known. Syntax sizeof( type ) (1) sizeof expression (2) Both versions return a value of type size_t. Explanation 1) Returns the size, in bytes, of the object representation of type 2) Returns the size, in bytes, of the object representation of the type of expression Notes Depending on the computer architecture, a byte may consist of 8 or more bits, the exact number provided as CHAR_BIT. si

fgets

Defined in header <stdio.h> char *fgets( char *str, int count, FILE *stream ); (until C99) char *fgets( char *restrict str, int count, FILE *restrict stream ); (since C99) Reads at most count - 1 characters from the given file stream and stores them in str. The produced character string is always null-terminated. Parsing stops if end-of-file occurs or a newline character is found, in which case str will contain that newline character. Parameters

realloc

Defined in header <stdlib.h> void *realloc( void *ptr, size_t new_size ); Reallocates the given area of memory. It must be previously allocated by malloc(), calloc() or realloc() and not yet freed with free, otherwise, the results are undefined. The reallocation is done by either: a) expanding or contracting the existing area pointed to by ptr, if possible. The contents of the area remain unchanged up to the lesser of the new and old sizes. If the area is expanded, the con

_Alignas

Usage _Alignas alignment specifier.

wcsftime

Defined in header <wchar.h> size_t wcsftime( wchar_t* str, size_t count, const wchar_t* format, tm* time ); (since C95) Converts the date and time information from a given calendar time time to a null-terminated wide character string str according to format string format. Up to count bytes are written. Parameters str - pointer to the first element of the wchar_t array for output count - maximum number of wide characters to write format - pointer to a nul

_Alignof

Usage _Alignof operator

logb

Defined in header <math.h> float logbf( float arg ); (1) (since C99) double logb( double arg ); (2) (since C99) long double logbl( long double arg ); (3) (since C99) Defined in header <tgmath.h> #define logb( arg ) (4) (since C99) 1-3) Extracts the value of the unbiased radix-independent exponent from the floating-point argument arg, and returns it as a floating-point value. 4) Type-generic macros: If arg has type long double, lo

Objects and alignment

C programs create, destroy, access, and manipulate objects. An object, in C, is region of data storage in the execution environment, the contents of which can represent values (a value is the meaning of the contents of an object, when interpreted as having a specific type). Every object has. size (can be determined with sizeof) alignment requirement (can be determined by alignof) (since C11) storage duration (automatic, static, allocated, thread-local) lifetime (equal to storage duration

iswalnum

Defined in header <wctype.h> int iswalnum( wint_t ch ); (since C95) Checks if the given wide character is an alphanumeric character, i.e. either a number (0123456789), an uppercase letter (ABCDEFGHIJKLMNOPQRSTUVWXYZ), a lowercase letter (abcdefghijklmnopqrstuvwxyz) or any alphanumeric character specific to the current locale. Parameters ch - wide character Return value Non-zero value if the wide character is a alphanumeric character, zero otherwise. Example

assert

Defined in header <assert.h> #ifdef NDEBUG #define assert(condition) ((void)0) #else #define assert(condition) /*implementation defined*/ #endif The definition of the macro assert depends on another macro, NDEBUG, which is not defined by the standard library. If NDEBUG is defined as a macro name at the point in the source code where <assert.h> is included, then assert does nothing. If NDEBUG is not defined, then assert checks if its argument (which must have scalar ty