【发布时间】:2020-08-27 16:02:04
【问题描述】:
问题更新:
在CS50的filter.c图像中定义为RGBTRIPLE(*image)[width] = calloc(height, width * sizeof(RGBTRIPLE));
这个符号在讲座中没有涉及,它令人困惑。我知道 calloc 正在为图像中的所有像素分配内存,但为什么使用 () 以及为什么不将其定义为 RGBTRIPLE image[height][width];
【问题讨论】:
-
那为什么不 image[][] = calloc... 或 image =calloc... 或者你只能为指针分配内存?
-
image[] = calloc... 有效吗?索引管理和我可以访问的一样 image[i][[j]