int locate_color( const uint8_t array[],
unsigned int cols,
unsigned int rows,
uint8_t color,
unsigned int *x,
unsigned int *y)
{
for (int z = 0; z < rows; z++)
{
for (int c = 0; c < cols; c++)
{
if (array[z] == color)
{
*x = color;
}
if (array[c] == color)
{
*y = color;
}
return 1;
}
return 0;
}
该函数是一个函数,用于定位数组中的颜色。它从左到右和从上到下搜索,找到它时,它将坐标存储到* x和* y中。但是当我运行代码时,它给了我一个错误。任何人都可以告诉我我错了哪里?定位c中的数组中的颜色
问题的标题没有描述问题。您应该更好地设置它,例如:*在循环*中出现错误或类似的东西。 –
yulian
2014-11-04 00:50:05