Heap: Heap Sort

What is wrong in my code?

you are printing the array from 1 to i<n
so only n-1 elements will be printed

Correct one

for(int i=1; i<=n; i++){

        cout<<v[i]<<" ";

    }