Malloc in C Language
Malloc ( ) : The function most commonly used for dynamic memory allocation is maloc ( ). The prototype of the function is given below –
void * malloc (size_+size)
Malloc ( ) returns a pointer to space for an object of size, or null if the request cannot be satisfied.
The syntax is the function is given below –
x = (int*)malloc(hundred * size of (int));
On successful execution of this statement, a memory space equivalent to ‘hundred times the size of an int’ bytes is reserved and the address of first byte of the memory allocated is assigned to the pointer x of type of int.
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment