题目
leetcode 118
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/7296bc9040d9d366a192c7628d42cc36.png)
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/c8ad69017b9be5b844bcdcf56b1a1e1a.png)
代码
int** generate(int numRows, int* returnSize, int** returnColumnSizes){
*returnSize = 0;
int **res = (int **)malloc(sizeof(int *) * numRows);
(*returnColumnSizes) = (int *)malloc(sizeof(int) * numRows);
for (int i = 0; i < numRows; i++) {
res[*returnSize] = (int *)malloc(sizeof(int) * (i + 1));
res[*returnSize][0] = 1;
int k = i - 1;
for (int j = 1; j < i; j++) {
res[*returnSize][j] = res[k][j - 1] + res[k][j];
}
res[*returnSize][i] = 1;
(*returnColumnSizes)[*returnSize] = i + 1;
(*returnSize)++;
}
return res;
}