/**
* Return an array of size *returnSize.
* Note: The returned array must be malloced, assume caller calls free().
*/
//返回一维数组, returnSize是指向size的指针
int* func(int rowIndex, int* returnSize) {
int *r=(int *)malloc(sizeof(int )*(rowIndex));
*returnSize=rowIndex;
}
/**
* Return an array of arrays.
* The sizes of the arrays are returned as *columnSizes array.
* Note: Both returned array and *columnSizes array must be malloced, assume caller calls free().
*/
//返回二维数组, columnSizes是指向数组的指针, 数组中存放size
int** generate(int numRows, int** columnSizes) {
int** r=(int **)malloc(sizeof(int *)*numRows);
int *s=(int *)malloc(sizeof(int )*x);
r[i]=s;
//*columnSizes是数组, (*columnSizes)[i]是数组元素
*columnSizes=(int *)malloc(sizeof(int )*numRows);
(*columnSizes)[i]=i;
}
[leetcode]C函数参数
最新推荐文章于 2024-09-24 00:00:00 发布