EasyManuals Logo
Home>Texas Instruments>Computer Hardware>TMS34010

Texas Instruments TMS34010 Reference Guide

Texas Instruments TMS34010
181 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #102 background imageLoading...
Page #102 background image
Allocate
and
Clear
Memory
calloc
Syntax
#include
<stdlib.h>
void
*ca11oc(nmemb,
size)
size-t
nmemb;
/*
number
of
items
to
allocate
*/
size-t
size;
/*
size
(in
bytes)
of
each
item
*/
Defined
in
memory. c in
rts.
src
Description
The calloc function allocates
size
bytes for each
of
nmemb
objects, and
returns a pointer
to
the space. The function initializes the allocated memory
to all
Os.
If
it
cannot allocate the memory (that
is,
if
it
runs
out
of
memory),
it returns a null pointer
(0).
Example
The memory that calloc
uses
is
in a special memory pool or
heap.
A C
module called memory. c
reserves
memory for the heap in the
.bss
section.
The constant
MEMORY-SIZE
defines the size
of
the heap
as
1000
bytes.
If
necessary, you
can
change the size
of
the heap by change the value
of
MEMORY-SIZE
and reassembling memory. c. For more information,
see
Section 5.1.3, Dynamic Memory Allocation, on page 5-4.
This example
uses
the calloc routine
to
allocate and clear
10
bytes.
ptr
=
calloc(10,2)
;
/*
Allocate
and
clear
10
bytes
*/
6-27

Table of Contents

Other manuals for Texas Instruments TMS34010

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments TMS34010 and is the answer not in the manual?

Texas Instruments TMS34010 Specifications

General IconGeneral
BrandTexas Instruments
ModelTMS34010
CategoryComputer Hardware
LanguageEnglish

Related product manuals