takes user input and stores it into passed array