How do the functions malloc( ) and calloc( ) work in C?

Asked

Viewed 109 times

0

I know that both functions allocate a memory space in bytes and returns the address of that memory, where calloc frees this space while in malloc the release must be made by the function free. But in code, how these functions work?

  • 1

    calloc() is equal to malloc() but it Zera the memory allocated, has nothing to release. The free() should be used no matter if used malloc(), calloc() or realloc() changing the position of an allocation. See https://answall.com/q/179205/101.

  • 1

    Also: https://answall.com/q/353757/101, https://answall.com/q/345055/101, https://answall.com/q/141975/101 and https://answall.com/q/276547/101

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.