Comparison operators

Comparison operators are binary operators that test a condition and return 1 if that condition is logically true and 0 if that condition is false.. Operator Operator name Example Description == equal to a == b a is equal to b != not equal to a != b a is not equal to b < less than a < b a is less than b > greater than a > b a is greater than b <= less than or equal to a <= b a is less than or equal to b >= greater than or eq

Common mathematical functions

Functions Defined in header <stdlib.h> abslabsllabs (C99) computes absolute value of an integral value (|x|) (function) divldivlldiv (C99) computes quotient and remainder of integer division (function) Defined in header <inttypes.h> imaxabs (C99) computes absolute value of an integral value (|x|) (function) imaxdiv (C99) computes quotient and remainder of integer division (function) Defined in header <math.h> Basic operations fa

Comments

Comments serve as a sort of in-code documentation. When inserted into a program, they are effectively ignored by the compiler; they are solely intended to be used as notes by the humans that read source code. Syntax /* comment */ (1) // comment\n (2) (since C99) 1) Often known as "C-style" or "multi-line" comments. 2) Often known as "C++-style" or "single-line" comments. All comments are removed from the program at translation phase 3 by replacing each comment with a single w

cnd_destroy

Defined in header <threads.h> void cnd_destroy( cnd_t* cond ); (since C11) Destroys the condition variable pointed to by cond. If there are threads waiting on cond, the behavior is undefined. Parameters cond - pointer to the condition variable to destroy Return value (none). References C11 standard (ISO/IEC 9899:2011): 7.26.3.2 The cnd_destroy function (p: 378-379)

cnd_wait

Defined in header <threads.h> int cnd_wait( cnd_t* cond, mtx_t* mutex ); (since C11) Atomically unlocks the mutex pointed to by mutex and blocks on the condition variable pointed to by cond until the thread is signalled by cnd_signal or cnd_broadcast. The mutex is locked again before the function returns. The behavior is undefined if the mutex is not already locked by the calling thread. Parameters cond - pointer to the condition variable to block on mutex - p

cnd_init

Defined in header <threads.h> int cnd_init( cnd_t* cond ); (since C11) Initializes new condition variable. The object pointed to by cond will be set to value that identifies the condition variable. Parameters cond - pointer to a variable to store identifier of the condition variable to Return value thrd_success if the condition variable was successfully created. Otherwise returns thrd_nomem if there was insufficient amount of memory or thrd_error if another er

cnd_signal

Defined in header <threads.h> int cnd_signal( cnd_t *cond ); (since C11) Unblocks one thread that currently waits on condition variable pointed to by cond. If no threads are blocked, does nothing and returns thrd_success. Parameters cond - pointer to a condition variable Return value thrd_success if successful, thrd_error otherwise. References C11 standard (ISO/IEC 9899:2011): 7.26.3.4 The cnd_signal function (p: 379) See also cnd_broadcast (C11)

cnd_timedwait

Defined in header <threads.h> int cnd_timedwait( cnd_t* restrict cond, mtx_t* restrict mutex, const struct timespec* restrict time_point ); (since C11) Atomically unlocks the mutex pointed to by mutex and blocks on the condition variable pointed to by cond until the thread is signalled by cnd_signal or cnd_broadcast, or until the TIME_UTC based time point pointed to by time_point has been reached. The mutex is locked again before the function returns. The

cnd_broadcast

Defined in header <threads.h> int cnd_broadcast( cnd_t *cond ); (since C11) Unblocks all thread that currently wait on condition variable pointed to by cond. If no threads are blocked, does nothing and returns thrd_success. Parameters cond - pointer to a condition variable Return value thrd_success if successful, thrd_error otherwise. References C11 standard (ISO/IEC 9899:2011): 7.26.3.1 The cnd_broadcast function (p: 378) See also cnd_signal (C1

clock

Defined in header <time.h> clock_t clock(void); Returns the approximate processor time used by the process since the beginning of an implementation-defined era related to the program's execution. To convert result value to seconds, divide it by CLOCKS_PER_SEC. Only the difference between two values returned by different calls to clock is meaningful, as the beginning of the clock era does not have to coincide with the start of the program. clock time may advance faster or sl