the code is not working … can you please explain
Build heap from array
Line 7 of your code int last = sizeof(a)/sizeof(a[0])-1; will have a value as 1 in every case. print its value and check. So instead of performing this operation, pass the value of last as a parameter to hepify function.