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

Discussion

The function ____ obtains block of memory dynamically.

  • A.calloc
  • B.malloc
  • C.Both a & b
  • D.free

Answer: C

Correct answer: Both a & b

malloc and calloc both obtain blocks of memory dynamically from the heap. They differ in how the size is expressed and in whether the block is zeroed, not in where the storage comes from.

malloc takes a single total and leaves the contents arbitrary; calloc takes a count and an element size and clears the block. free is the counterpart that returns storage rather than obtaining it, and realloc resizes a block already held.

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

Post your comment

Please log in or register to post a comment.