我真的很难找到这里有什么问题。请帮忙。
我主要声明(宽度和长度已知):
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];
但没有运气。先感谢您。