The thing happening here is a pass by reference, which is different from pass by pointer, where you pass the address of a variable into a function (when calling it) and the function's definition accepts a pointer. Here, you are basically passing a pointer to the vector as an argument and thus doing a pass by pointer :

coverTransactions(3, &matrix)

, whereas according to your function's definition, a pass by reference is happening here, hence, simply pass the vector as it is in the function :

coverTransactions(3, matrix)

The difference between the above two methods are that a pointer can be NULL, but references are never NULL, and hence we are sure that we are referencing a valid variable. That's why it's a good practice to use references whenever you can, and use pointers only when you have to.