Alright, let's see exactly why this doesn't work (compared to the un-helpful post above)...
Well, for one, you're displaying the array as-is in the for loop, then sorting it... then you display what sort() churns out, which in this case is just the value of T at n, which is outside of its bounds (unallocated memory. This is why at the end of running, it dumps some non-existent number at the end). Really, the issue here is what your sort() function returns. Fix that, and you'll be golden.