Storing value in array

How can i store the value in array if the input is in integer and the value gets stored in array if enter is pressed.
For example:-
1,2,3,4,5

Just after pressing enter,the value gets stored in array and array size is not declared and comma is also passed as input parameter.