【发布时间】:2013-02-05 04:32:30
【问题描述】:
这是我在 atmel 6 中使用 c 的代码:
#include <avr/io.h>
#include <stdio.h>
#include <math.h>
int a[][][] initialize_hueristic(int[]);
int main(void)
{
int goal[3],grid_size[3];
int i, j, k;
int hueristic[grid_size[0]][grid_size[1]][grid_size[2]];
hueristic = initialize_hueristic(grid_size);
hueristic[0][1][0] = 10;
PORTA = hueristic[0][1][0];
}
int a[][][] initialize_hueristic(int grid_size[])
{
int hueristic[grid_size[0]][grid_size[1]][grid_size[2]];
int i, j, k;
for(i = 0; i < grid_size[0] ; i++)
{
for(j = 0; j < grid_size[1]; j++)
{
for(k = 0; grid_size[2]; k++)
{
hueristic[i][j][k] = 0;
}
}
}
return hueristic;
}
atmel 工作室告诉我以下错误:
1.incompatible types when assigning to type 'int[(unsigned int)(grid_size[0])][(unsigned int)(grid_size[1])][(unsigned int)(grid_size[2])]' from type 'int'
2.expected '=', ',', ';', 'asm' or '__attribute__' before 'initialize_hueristic'
3.expected '=', ',', ';', 'asm' or '__attribute__' before 'initialize_hueristic'
有人可以告诉我代码中的错误吗??
【问题讨论】:
-
什么是
int a[][][]? -
“启发式”的“e”和“u”正好相反。
-
@AbhishekVJoshi :如果有帮助,请为答案投票。您也可以接受最佳答案。