>> why can't I do with a reference?
Why do you want to do it with a reference? What do you think will happen that will make things better? What would be the point? Why? Your code is exactly the same whether you use a reference or a pointer except for the declaration of q which uses & or *. Everything else is the same. Why do you think a reference is "better"?
>> You can and should do it with a reference.
No. You should use a pointer. There is no reason to use a reference to a pointer to point to an array. Just use a regular pointer.