ceil
7-27
Run-Time-Support Functions
Allocate and Clear Memory
calloc
Syntax
#include <stdlib.h>
void *
calloc
(size_t num, size_t size);
Defined in
memory.c in rts.src
Description
The calloc function allocates size bytes (size is an unsigned integer or size_t)
for each of nmemb objects and returns a pointer to the space. The function ini-
tializes the allocated memory to all 0s. If it cannot allocate the memory (that
is, if it runs out of memory), it returns a null pointer (0).
The memory that calloc uses is in a special memory pool or heap, defined in
an uninitialized named section called .sysmem in memory.c. The constant
__SYSTEM_SIZE defines the heap as 1K words. You can change this amount
at line time by invoking the linker while the _heap option and specifying the
desired size of the heap directlyafter the option. For more information, see sec-
tion 6.1.4, Dynamic Memory Allocation, on page 6-6.
Example
This example uses the calloc routine to allocate and clear 20 bytes.
prt = calloc (20,2); /*Allocate and clear 20 bytes */
Ceiling
ceil
Syntax
#include <math.h>
double
ceil
(double x);
Defined in
ceil.c in rts.src
Description
The ceil function returns a floating-point number that represents the smallest
integer greater than or equal to x. The ceil function is inlined if the
−
x2 option
is used.
Example
double answer;
answer = ceil(3.1415);
/* answer = 4.0 */
answer = ceil(−3.5);
/* answer = −3.0 */
Summary of Contents for TMS320C2x
Page 8: ...viii...
Page 69: ...2 47 C Compiler Description...
Page 159: ...6 36...
Page 226: ...8 6...