Created by: yu239-zz
The matrix pointer was originally passed by copy, which is a problem if the memory is allocated inside the function.