Friday, 11 July 2014

Dynamic memory allocation

No comments:

  1.  Malloc will be defined in the stdlib.h or malloc.h depending on the operating system we  use.
  2. Malloc does not reset the bits to zero
  3. malloc returns null if memory cannot be allocated

  1. Calloc allocates the memory based on the two parameter. second parameter says how much memory should be allocated and first how many memory like that to be created,
  2. calloc(count,sizeof(individual))
  3. c in calloc stands for clear or count
  4. Calloc reset all the bits to zero
  5. Calloc returns null if memory cannot be allocatedEE

  1. If developer wish to increase or decrease the size, one can use the realloc function
  2. The content of the previous value will be left unchanged
  3. If ptr is null then reealloc function will work as same of malloc function.
  4. reallloc can create the memory at different place and copy the content.

No comments:

Post a Comment