answersLogoWhite

0

What is the malloc function?

Updated: 10/13/2022
User Avatar

Wiki User

14y ago

Best Answer

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.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the malloc function?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Function used to free memory allocated by malloc?

The free() function.


What is the datatype of the pointer returned by malloc function?

void


What function allocate n bytes in heap memory?

malloc


What is a malloc function in C programming with example?

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 */


What is falloc?

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.

Related questions

Function used to free memory allocated by malloc?

The free() function.


What is the datatype of the pointer returned by malloc function?

void


What is the default datatype of the pointer returned by malloc function?

void


What function allocate n bytes in heap memory?

malloc


What is a malloc function in C programming with example?

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 */


What is really meant by malloc and where you will use this malloc?

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.


What is library function in C programming?

printf, fgets, strlen, malloc etc


How does the free function work in c language?

free() marks the memory locations as available for malloc().


What is falloc?

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.


71 Which function should be used to free the memory allocated by calloc?

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.


Which function should be used to free the memory allocated by calloc?

Use the free function to release memory that was previously allocated by malloc, calloc or realloc.


Difference between malloc and alloc?

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