Closed Chewhern closed 3 years ago
Just copy/pasting the documentation:
The
sodium_allocarray()
function returns a pointer from whichcount
objects that aresize
bytes of memory each can be accessed. It provides the same guarantees assodium_malloc()
but also protects against arithmetic overflows whencount * size
exceedsSIZE_MAX
.
I am wondering what's the difference between sodium_malloc and sodium_allocarray?
Can anyone explains them in a simple explanation with easy to understand examples?