running int a strange scenario where malloc is allocating more memory than I ask for:
void function (int array [], int numberOfElements) { int *secondArray = ma
malloc is actually allocating exactly the right amount.
malloc
However, you're accessing memory beyond the allocation.
What exists there is completely undefined and could really be anything.
In your case, it was one "junk" number and four zeroes.