Malloc in C Language

No comments



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.

No comments :

Post a Comment

Subscribe

Milan Panda
Admin
About Me | Contact
Copyright 2023-2024 © Programming1011 . 🎀 Developed and Design By- Milan Panda. Happy Holi All Of You 🎀