annotate docs/ccguide/malloc.refentry @ 570:253b6096ee01

All function prototypes are added.
author roug
date Fri, 01 Nov 2002 10:02:34 +0000
parents 74609258dd88
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
466
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
1 <refentry id="malloc">
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
2 <refnamediv>
527
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
3 <refname>Malloc</refname>
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
4 <refname>Free</refname>
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
5 <refname>Calloc</refname>
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
6 <refpurpose>memory allocation</refpurpose>
466
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
7 </refnamediv>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
8
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
9 <refsynopsisdiv>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
10 <funcsynopsis>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
11 <funcprototype>
527
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
12 <funcdef>char *<function>malloc</function></funcdef>
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
13 <paramdef>unsigned <parameter>size</parameter></paramdef>
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
14 </funcprototype>
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
15
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
16 <funcprototype>
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
17 <funcdef><function>free</function></funcdef>
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
18 <paramdef>char *<parameter>ptr</parameter></paramdef>
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
19 </funcprototype>
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
20
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
21 <funcprototype>
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
22 <funcdef>char *<function>calloc</function></funcdef>
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
23 <paramdef>unsigned<parameter>nel</parameter></paramdef>
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
24 <paramdef>unsigned<parameter>elsize</parameter></paramdef>
466
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
25 </funcprototype>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
26 </funcsynopsis>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
27
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
28 </refsynopsisdiv>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
29
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
30 <refsect1><title>Description</title>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
31 <para>
527
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
32 Malloc returns a pointer to a block of at least "size" free bytes.
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
33 </para>
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
34 <para>
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
35 Free requires a pointer to a block that has been allocated by
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
36 malloc; it frees the space to be allocated again.
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
37 </para>
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
38 <para>
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
39 Calloc allocates space for an array. Nel is the number of
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
40 elements in the arrary, and elsize is the size of each element.
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
41 Calloc initializes the space to zero.
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
42 </para>
533
74609258dd88 Mainly section structures added.
roug
parents: 527
diff changeset
43 </refsect1>
527
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
44 <refsect1><title>Diagnostics</title>
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
45 <para>
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
46 Malloc, free, and calloc return NULL(0) if no free memory can
10d95ea9f140 Finished these entries
roug
parents: 466
diff changeset
47 be found or if there was an error.
466
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
48 </para>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
49 </refsect1>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
50 </refentry>