home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD2.bin
/
bbs
/
dev
/
cmanual-3.0.lha
/
CManual
/
Intuition
/
Miscellaneous
/
Example1.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-12
|
2KB
|
51 lines
/***********************************************************/
/* */
/* Amiga C Encyclopedia (ACE) V3.0 Amiga C Club (ACC) */
/* ------------------------------- ------------------ */
/* */
/* Book: ACM Intuition Amiga C Club */
/* Chapter: Miscellaneous Tulevagen 22 */
/* File: Example1.c 181 41 LIDINGO */
/* Author: Anders Bjerin SWEDEN */
/* Date: 92-05-01 */
/* Version: 1.10 */
/* */
/* Copyright 1992, Anders Bjerin - Amiga C Club (ACC) */
/* */
/* Registered members may use this program freely in their */
/* own commercial/noncommercial programs/articles. */
/* */
/***********************************************************/
/* This example shows how to allocate, and deallocate memory. */
#include <exec/types.h> /* Declares CPTR. */
#include <exec/memory.h> /* Declares MEMF_CHIP. */
main()
{
/* Declare a pointer to the memory you are going to allocate: */
CPTR memory;
/* Allocate 150 bytes of Chip memory: */
memory = (CPTR) AllocMem( 150, MEMF_CHIP );
/* Have we allocated the memory successfully? */
if( memory == NULL )
{
printf("Could not allocate the memory!\n");
exit();
}
/* Do whatever you want to do with the memory! */
/* Free the memory we have previously allocated: */
FreeMem( memory, 150 );
}