Sorting an array by reference
I made a simple routine to sort an array witch accepts as a parameter an array of ints the problem is that when i compare the values array[i] shows the correct value in the debugger but array[i + 1] shows a bogus value ... i guess is a pointer issue but i can't figure it out what i am doing wrong.

Here is the code :

    typedef int vector[10];
    
    void task1(vector * param)
    {
    	bool ordered = false;
    	while (!(ordered))
    	{
    		int tmp = 0;
    		ordered = true;
    		for (int i = 0; i < 9 ; i++)
    		{
    			if (*param[i] > *param[i+1])
    			{
    				tmp = *param[i];
    				*param[i] = *param[i + 1];
    				*param[i + 1] = tmp;
    				ordered = false;
    			}
    		}
    	}
    
    }
    
    int _tmain(int argc, _TCHAR* argv[])
    {
    	vector tavi = {10,88,77,192,7,27,82,1,882,13};
    	
    	task1(&tavi);
    	for (int i = 0 ; i < 10 ; i ++)
    		printf("%d ",tavi[i]);
    
    	_getch();
    
    
    	return 0;
    }


Sorting an array by reference
===

I made a simple routine to sort an array witch accepts as a parameter an array of ints the problem is that when i compare the values array[i] shows the correct value in the debugger but array[i + 1] shows a bogus value ... i guess is a pointer issue but i can't figure it out what i am doing wrong.

Here is the code :

    typedef int vector[10];
    
    void task1(vector * param)
    {
    	bool ordered = false;
    	while (!(ordered))
    	{
    		int tmp = 0;
    		ordered = true;
    		for (int i = 0; i < 9 ; i++)
    		{
    			if (*param[i] > *param[i+1])
    			{
    				tmp = *param[i];
    				*param[i] = *param[i + 1];
    				*param[i + 1] = tmp;
    				ordered = false;
    			}
    		}
    	}
    
    }
    
    int _tmain(int argc, _TCHAR* argv[])
    {
    	vector tavi = {10,88,77,192,7,27,82,1,882,13};
    	
    	task1(&tavi);
    	for (int i = 0 ; i < 10 ; i ++)
    		printf("%d ",tavi[i]);
    
    	_getch();
    
    
    	return 0;
    }

