/**
* 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
*
*
* @param nums int整型一维数组
* @param numsLen int nums数组长度
* @return int整型一维数组
* @return int* returnSize 返回数组行数
*
* C语言声明定义全局变量请加上static,防止重复定义
*/
#include <stdlib.h>
int cmpfunc(const void *a,const void *b)
{
return (*(int *)a) -(*(int *)b);
}
int* sortedArray(int* nums, int numsLen, int* returnSize ) {
// write code here
*returnSize = numsLen;
for (int i = 0; i < numsLen; i++)
nums[i] = nums[i] * nums[i];
qsort(nums, *returnSize, sizeof(int), cmpfunc);//快速排序
return nums;
}