replacing array to pointers