C

Top  Previous  Next

calloc

#include <stdlib.h>

void *calloc (

   size_t nelem,

   size_t elsize

);

stand-alone

stack: 56 bytes

calloc returns a pointer to enough space for nelem objects of size elsize, or NULL if the request cannot be satisfied. The space returned is aligned on an 8-byte boundary and is initialized to zero. Note that elsize must specify the size of the object in octets (eight-bit bytes).

chan...

ceil

#include <math.h>

double ceil (

   double x

);

 stand-alone

ceil returns as a double value the smallest integer not less than x.

 

Dragons003Common error: If you forget to include math.h, the compiler automatically declares a function returning int and will give unpredictable results.

channel functions

clearerr

#include <stdio.h>

void clearerr (

   FILE *stream

);

 

clearerr resets any error indication on the named stream.

clock

#include <time.h>

clock_t clock(void);

 server

The clock function returns the time elapsed on the host PC since an (unspecified) base time as the best approximation to the processor time used. The type (clock_t) of the value returned by clock is int. The units used are not specified by the ANSI standard. To find the number of seconds that have gone by since the base time, you should divide the result of clock by the value of the macro CLOCKS_PER_SEC, which is 1 in the current implementation. Note that since the base time is not specified, a program usually calls clock at least twice: once at the start of a section of code to be timed, and once at the end. Subtracting the first clock value from the second and then dividing the result by CLOCKS_PER_SEC gives the number of seconds taken by the code section. clock requires communication with the server, and is accurate only to the nearest second. Do not use clock to measure the time taken to execute sections of code on the target processors. Use Diamond's timer_now function, which offers millisecond resolution, and time a large number of repetitions of the code sequence to minimize effects of interrupts and cache manipulation.

cos

#include <math.h>

double cos (

   double x

);

 stand-alone

cos returns the cosine of its radian argument. For very large magnitudes of x (|x| greater than about 12000), the function returns 0 and sets errno to ERANGE.

 

Dragons003Common error: If you forget to include math.h, the compiler automatically declares a function returning int and will give unpredictable results.

cosh

#include <math.h>

double cosh (

   double x

);

 stand-alone

 

cosh returns the hyperbolic cosine of its argument. If the magnitude of x is too large, HUGE_VAL is returned, and errno is set to the value ERANGE.

 

Dragons003Common error: If you forget to include math.h, the compiler automatically declares a function returning int and will give unpredictable results.