Modified the declarations of functions gatherMatrices(), decreaseMatrices(), multiplyMatrixWithScalar(). Now third parameter is pointer to pointer.