函数操作数组 只能将数组写入到参数中进行操作
引用符号 & : 类似于指针,通过内存地址引用指定的变量或者数组
快捷键是 Shift + 7
// 程序执行入口
void OnStart()
  {
//    int arr[] = {3,2,9,1,7,8,4,5,6};
//    sort(arr);
//    ArrayPrint(arr);
//    
//    int arr2[] = {13,22,9,51,77,8,24,65,61};
//    sort(arr2);
//    ArrayPrint(arr2);
    int arr[] = {3,2,9,1,7,8,4,5,6};
    int out_arr[];
    sort(arr,out_arr);
    ArrayPrint(out_arr);
  }
void sort(int &arr[], int &out_arr[])
{
  int size = ArraySize(arr);
  // 重置输出数组的长度和源数组一样
  ArrayResize(out_arr,size);
  // 再将原数组的数据复制给需要输出的数组
  ArrayCopy(out_arr,arr);
  for(int i = 0; i < size; i++)
  {
     // 节流锁
     bool lock = false;
     for(int j = 0; j < size - 1; j++)
     {
         if(out_arr[j] > out_arr[j + 1])
         {
            int temp = out_arr[j];
            out_arr[j] = out_arr[j + 1];
            out_arr[j + 1] = temp; 
            lock = true;
         }   
     }
     if(lock == false) break;
  }
}
		                
瓜皮猫量化编程

