What you are doing gives this result if you print temp1 and a[i] in that loop
You are in no way
reversing an array.
Next time, please
try to write down in simple english what you want to do (meaning an algorithm) and then try again. Do not simply try to use bits and pieces from everywhere such as exchange used in sorting. No matter, here's a better way:
<p> for (int i = 0; i < b; i++)</p>
<p> temp1[i] = a[b-i-1];</p>