What is static memory allocation and dynamic memory allocation?
By admin on Jan 17, 2007 in C Interview Questions, Technical
Static memory allocation:
The compiler allocates the required memory space for a declared variable.By using the address of operator,the reserved address is obtained and this address may be assigned to a pointer variable.Since most of the declared variable have static memory,this way of assigning pointer value to a pointer variable is known as static memory allocation. memory is assigned during compilation time.
Dynamic memory allocation:
It uses functions such as malloc( ) or calloc( ) to get memory dynamically.If these functions are used to get memory dynamically and the values returned by these functions are assingned to pointer variables, such assignments are known as dynamic memory allocation.memory is assined during run time.



2 Comment(s)
By sandip on Mar 2, 2007 | Reply
please explain.. about following
1)automatic allocation
2)program controlled alloction
these are two scheme of dynamic allocation
By kishore on Jul 29, 2008 | Reply
then what about dynamic allocation
mean providing space by user