ここで何が問題なのかを見つけるのに本当に苦労しています。助けてください。
主に、宣言します(幅と長さはわかっています):
short** the_image;
print_image_array(the_image,image_width,image_length);
どこ
print_image_array(the_image, image_width, image_length)
short** the_image;
long image_width, image_length;
{
int i, j;
for (i=0; i < image_length; i++) {
for (j=0; j < image_width; j++)
printf("%d ", the_image[i][j]);
printf("\n");
}
}
そして、valgrind から、次のメッセージが表示されます。
==2423== at 0x80490D2: print_image_array
==2423== by 0x80491F3: main
==2423== Uninitialised value was created by a stack allocation
==2423== at 0x804911E: main
==2423==
==2423== Invalid read of size 2
==2423== at 0x80490DB: print_image_array
==2423== by 0x80491F3: main
==2423== Address 0x1e5ec381 is not stack'd, malloc'd or (recently) free'd
イメージが初期化されないのはなぜですか? 私も宣言してみました
short the_image[length][width];
しかし運がない。前もって感謝します。