I don't fully understand the detailed logic.
Nevertheless, the thing obviously missing is return 0; at the end of main(). It may be that ideone is sensitive to the value returned when the program terminates.
In function ‘main’:
150:1: warning: control reaches end of non-void function [-Wreturn-type] (C90)
In function ‘deletearr’:
134:1: warning: control reaches end of non-void function [-Wreturn-type]
118:19: warning: ‘min’ may be used uninitialized in this function [-Wmaybe-uninitialized]
¿detailed logic? ¿where?
I traced the code through using a debugger, and paid no attention to the significance or validity of any of the code, other than seeing that it didn't use uninitialised values or clearly out-of bounds array values.