Whoops, that was a typo. Yes that is what I should have in the function (but the error still persists).
The &whatever->data is supposed to pass the address of the data, which is to hold an array of ints (which I used as int* instead of int[] because the size is never constant). That way, the function can resize the data to accomodate for each new element of data. Perhaps I did this the wrong way?