#include<stdio.h>
#include<stdlib.h>
void sort(int* arr,int size)
{
int i=0,j=0,tmp;
if(size <=0)
return ;
for(;i<size;i++)
{
//for(j=i;j<size;j++) //this sentence is ok
for(j=size;j>i;j--) //this sentence is ok also
{
if(arr[i] > arr[j])
{
tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
}
}
}
return ;
}
int main()
{
int arr[1024],i=0;
for(;i<1024;i++)
{
arr[i] = random()%1024;
}
sort(arr,1024);
for(i=0;i<1024;i++)
{
printf("arr[%d] = %d\n",i,arr[i]);
}
return 0;
}