Undefined behavior in your code. I suppose by doing this:
array=(int*)realloc(array,sizeof(int)+sizeof(*array));
you expect to sizeof(*array)return the size of the entire array to you, right? But this is not so. sizeofcomputed at compile time, but sizeof(*array)actually matches sizeof(int).
So, to make this array extensible, you need to have an additional variable, holding the current number of elements and doing something like:
array=(int*)realloc(array, sizeof(int) + current_size_of_array * sizeof( int ) );
current_size_of_array for, .