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

Discussion

The call realloc(NULL, size) is equivalent to ________.

  • A.free(size)
  • B.malloc(size)
  • C.calloc(1, size)
  • D.an error

Answer: D

Correct answer: malloc(size)

The standard defines realloc() with a null first argument to behave exactly like malloc(). This lets a growing buffer be managed by a single realloc() call in a loop, with no special case for the first allocation.

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

Post your comment

Please log in or register to post a comment.