小编D_M*_*Man的帖子

c中带有2d数组参数的函数调用和函数原型

void setup_map (int *map); <--- prototype

int row, col;  <-- global variables

some main 
{
  //get number of rows and cols from user
  int map[rows][cols]; //create map here because another function uses it
  setup_map (map[row][col]);
}

void setup_map (int map[row][col])
{
  loop through and set up map
}
Run Code Online (Sandbox Code Playgroud)

我的问题是我不能完全正确地设计原型,我希望有什么地方可以向我解释原型需要是什么?我刚刚开始学习指针,并非常了解这个概念,只是从未使用过2d数组作为参数。谢谢你的帮助。

c arrays syntax function-prototypes

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

arrays ×1

c ×1

function-prototypes ×1

syntax ×1