malloc-etc

malloc-etc - MALLOC(3) Linux Programmer’s Manual...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
MALLOC(3) Linux Programmer’sManual MALLOC(3) NAME calloc, malloc, free, realloc - Allocate and free dynamic memory SYNOPSIS #include <stdlib.h> void *calloc(size_t nmemb ,size_t size ); void *malloc(size_t size ); void free(void *ptr ); void *realloc(void *ptr ,size_t size ); DESCRIPTION calloc() allocates memory for an array of nmemb elements of size bytes each and returns a pointer to the allocated memory .The memory is set to zero. malloc() allocates size bytes and returns a pointer to the allocated memory .The memory is not cleared. free() frees the memory space pointed to by ptr ,which must have been returned by a previous call to mal- loc() , calloc() or realloc() .Otherwise, or if free( ptr ) has already been called before, undefined behaviour occurs. If ptr is NULL ,nooperation is performed. realloc() changes the size of the memory block pointed to by ptr to size
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/05/2009 for the course COMP 2510 taught by Professor A during the Spring '06 term at BC.

Ask a homework question - tutors are online