reverse c++ array
<p>my aim is to reverse an array 3,12,2,1 to 1,2,12,3. when i run this code i get garbage before my actually result. i can't seem to see where the problem is please assit</p>

<pre><code>#include&lt;iostream&gt;
using namespace std;


int rev (int arr[], int a){
    //int r;
    for(int i =a-1; i&gt;=0; i--){
    cout&lt;&lt;arr[i]&lt;&lt;" "; 
    }   
   return 0;
 }

 int main(){
 int arr[] = {6,41,12,5,2};

cout&lt;&lt;"The rev of {6,41,12,5,2}"&lt;&lt;endl;
 cout&lt;&lt;rev(arr, sizeof(arr))&lt;&lt;endl;


   system("pause");
   return 0;
}
</code></pre>
