我声明了一个应该是像素的结构,它有 3 个属性(x
、y
位置和F
强度),如下所示:
struct pixel {
int F, // intensity from 0-255
x, // horizontal component
y; // vertical component
};
然后我声明了一个像素类型的二维数组(上面的结构),如下所示:
int N=100;
pixel image[N][N];
然后我使用以下循环将值分配给x
and y
:
int count, k;
for (int i=0 ; i<N ; i++)
for (int j=0 ; j<N ; j++)
{
k = j + i*N;
image.x[k] = count;
count++;
}
我做错了什么?