I have been trying this for a week and i still dont understand how to do it. I have to reverse the elements of an a array. I turned the problem into the teacher already and she said all i did was print them backwards and not reversed the elements. I know how to exchange values but i just cant figure this problem out.
this is my array.....can u help me reverse the elements..??
Create a second array of the same size. Then perform the following algorithm:
array_new  = array_old [N]
array_new  = array_old [N-1]
array_new [N] = array_old 
Then you could copy array_new to array_old so array_old is reversed. Or you could change pointer of something different.
Use a temporary variable to keep old value and use this for switching. Algorithm:
temp_value = array 
array  = array [N]
array [N] = temp_value
...etc. Take care if the numer of elements is odd.