(With some copy-paste from my comment:) sizeof(array) returns 8 because it equals sizeof(int*) which is 8 (you're probably compiling as 64-bit). sizeof doesn't work how you think for pointers to arrays.

Similarly, your output code is wrong, for the same reason. You only print the first two elements because sizeof(array)/sizeof(int) will always be 8/4=2. It should be

for(int s=0;s<size;s++){
printf("%i\n",array[s]);
}

(note also changed index variable i to s)
where size is the variable from your other code chunk(s). You cannot find the length of the array from sizeof if it's dynamically allocated with pointers; that's impossible. Your code must "remember" the size of your array.