c 编译器无法理解 2d array of rgb values 的声明

问题描述 投票:0回答:0

以下代码在使用 clang 编译器的朋友 MacOs 机器上运行。但是,当我尝试在我的 Windows 机器上编译它时出现以下错误。

   RGB(*image_mat)[width] = calloc(height, width * sizeof(RGB));

错误:

main.c:107:5: error: expected identifier or '(' before '[' token
  107 |     [width] = calloc(height, width * sizeof(RGB));
      |     ^
main.c:108:9: error: 'image_mat' undeclared (first use in this function)
  108 |     if (image_mat == NULL)```
arrays c calloc
© www.soinside.com 2019 - 2024. All rights reserved.