a question of style



I am curious about whether I should do this

say I want to calculate dot product of two matrix(4X4,fixed)
I do two ways

1)
void dot_product(double A[4][4] , double B[4][4], double result[4][4]){
blah blah

}

my results are automatically given back in the matrix result[4][4]

or

2)
double [4][4] dot_product(double A[4][4],double B[4][4]){
double result[4][4];
blah blah

return result;
}

for the second type, result is local variable and will be released
after function call, Will the program have problem to access?

Are there better and neat way to this problem?

Thanks

.