Answers to questions on dynamic memory allocation

  1. What is the most significant difference between malloc and calloc?
    calloc initialises the space to all zeros, while malloc leaves it as it is.

  2. How does malloc rquire you to specify how much space in the heap you require and how can you find this out?
    It requies you to give a number of bytes. This can be determined by using the library function sizeof.

Back to to the questions.


Back to notes on dynamic memory allocation.