/**
* 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
*
*
* @param n int整型 最大位数
* @return int整型一维数组
* @return int* returnSize 返回数组行数
*/
#include <math.h>
int* printNumbers(int n, int* returnSize ) {
// write code here
int *ret = NULL;
int count = 0;
int max = pow(10, n);
while(count+1 < max)
{
int *p = (int*)realloc(ret, sizeof(int)*(count+1));
if (p == NULL)
{
perror("realloc");
return 0;
}
ret = p;
count++;
ret[count-1] = count;
}
*returnSize = count;
return ret;
}



京公网安备 11010502036488号