The problem is not solved by using unsigned ints though, because it stems from integer overflow. I'm afraid your implementations are, alas, also incorrect.
char array[60000]; // 5KB left for code and stack if not segmented
size_t i = 40000;
size_t j = 50000;
size_t mid = (i+j)/2; // should be 45000
// i+j = (size_t)90000 = 24464
// mid = 24464/2 = 12232 != 45000
Larger integers make the necessary array size bigger, but don't change the overall issue.