Machine-translated by Google. Questions are authored in English.
Top

Discussion

What function should be used to free the memory allocated by calloc() ?

  • A.dealloc();
  • B.malloc(variable_name, 0)
  • C.free();
  • D.memalloc(variable_name, 0)

Answer: C

Correct answer: free();

Memory from calloc is released by free, exactly as memory from malloc or realloc is. There is one deallocation function for all three.

That is possible because all three obtain their storage from the same allocator; the difference between them lies in how the block is sized and whether it is zeroed, not in where it comes from. The other names offered are not part of standard C.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.