The fact that you could and should use an std::vector<int>
aside, data
is being passed as a pointer by value here:
void addValue(int data[], int& logSize, int& physSize, int newValue)
(for int data[]
, read int* data
). So `addValue has its own copy of the pointer, and whatever it does with it has no effect on the caller side. You can fix this particular problem by passing the pointer by reference:
void addValue(int*& data, int& logSize, int& physSize, int newValue)