07.02.2017, 08:35
thats because you are using variable "i" in the creating function which will be always 0 and on each creation index 0 is getting replaced one solution could be changing this to an iterator or declare variable I in that function as static and on the end of function increment it (which I wont recommend) or loop through indexes as you did in 2nd function find the index having null element and use that index.


