I was asked this question in a interview, what is the minimum size malloc can allocate and what is the max size a malloc can allocate.
I answered min size if 1 byte
, and when I told that he replied assuming that is correct now tell me what is the max size memory chunk can malloc
allocate( when you try doing malloc
it fails sometime), think you have 4GB
of RAM with you write me a code to find the size of heap segment for your simple program you write or write me a code to find the size of stack segment.
Can any one help me in this solution.
Is the minimum size it can allocate is 1 byte
? I answered thinking char requires the least memory.