Linear Recursion reverse the array. : //cant figure out why my recursion function doesnt work
   

    #include <iostream>
    
    using namespace std;
    
    
    
    int ReverseArray(int* A, int i, int j);
    
    
    int main()
    {
    	int j = 10;
    	int i = 0;
    	int *b = new int[j];
    
    	for (int i = 0; i <= 10; i++)
    		b[i] = i;
    
//just to compare the old and new array

    	for (int i = 0; i <= 10; i++)
    		cout << b[i] << endl; //just to compare the 
    
    	for(int i = 0; i <= j; i++)
    	cout << ReverseArray(b,i,j) << endl;
    
    
    
    	system("pause");
    	return 0;
    }
    
    int ReverseArray(int* A, int i, int j)
    {
    	if (i <= j)
    	{
    		swap(A[i], A[j]); 
    		ReverseArray(A, i + 1, j - 1);
    		
    	}
    
    	return A[i];

//this should return 10,9,8.... but it return 10,0,9,1... i dont get why its happening