The malloc function is one of a group of memory allocation functions; malloc, calloc, realloc, and free. Specifically malloc (size) returns a pointer to a new memory block of at least size bytes, suitably aligned for optimum access for any basic type, or it returns a NULL if the request cannot be satisfied.
The free() function.
void
malloc
The malloc() function is part of a class of functions that deal with the allocation of memory on the heap. int *a = malloc (sizeof (int) * 100); /* allocate 100 int's */ if (a == NULL) {...} /* deal with possible malloc failure */ /* use a, either as pointer or as array of 100 ints */ free (a); /* release memory back to the library */
falloc is a function similar to malloc. Where the function malloc returns a pointer to an area of memory, falloc returns a "far" pointer to a "far" area of memory; i.e., memory that goes beyond the segmented memory limitations inherent to x86 memory architecture.
The free() function.
void
void
malloc
The malloc() function is part of a class of functions that deal with the allocation of memory on the heap. int *a = malloc (sizeof (int) * 100); /* allocate 100 int's */ if (a == NULL) {...} /* deal with possible malloc failure */ /* use a, either as pointer or as array of 100 ints */ free (a); /* release memory back to the library */
malloc is a function of the standard c library (stdlib) and it is abbreviation for memory allocate. What this function does is allocates memory in the RAM of computer to store variable data in it. You will use it whenever you need a place to store you temporary data such as an array or structure. To use malloc all you have to do is call malloc and tell it the size of the memory you want. It will then return a pointer to that memory. persumabely if it fails it returns NULL.
printf, fgets, strlen, malloc etc
free() marks the memory locations as available for malloc().
falloc is a function similar to malloc. Where the function malloc returns a pointer to an area of memory, falloc returns a "far" pointer to a "far" area of memory; i.e., memory that goes beyond the segmented memory limitations inherent to x86 memory architecture.
free() is a function used to free the memory allocated dynamically ,by both malloc and calloc functions. free(ptr): ptr is a pointer to a memory block which has already been creeated by malloc or calloc.
Use the free function to release memory that was previously allocated by malloc, calloc or realloc.
alloc is used as header file while using malloc and calloc functions in C prog.The definition of malloc function is in the alloc.h file.It's stdlib.h to be more precise