I am trying to sort array in increasing order

my approach for sequence 5 4 3 2 1 is like following

5 > 4 True 4 5 3 2 1

5 > 3 True 4 3 5 2 1

5 > 2 True 4 3 2 5 1

5 > 2 True 4 3 2 1 5


4 > 3 True 3 4 2 1 5

4 > 2 True 3 2 4 1 5

4 > 1 True 3 2 1 4 5

and so on ...


Code:
  #include<stdio.h>

int main()
{
    int array[5] = {5, 4, 3, 2, 1 };
	int temp[5];
	
	for ( int i = 0; i < 5; i++)
	{
		for ( int j = 0; j < 5; j++)
		{
			if (array[i] > array[j+1])
			{
				temp[i] =  array[i];
			}			
			
			
		}
	}
	
	for ( int i = 0; i < 5; i++)
	{
		printf("%d", temp[i]);
	}
	
	return 0;
}
I am struggling in swapping array value

I know swapping

x = 1
y = 100
temp =x
x = y = 100
y = temp = 1