この状況でポインタがアドレスを変更する理由を理解できないようです:
int *load(FILE *fp, int * vector, int w, int h){
//other coding
int array[w][h];
int *ptr = &array;
return ptr;
}
main(){
//other coding
int *ptr = load(file, vector, w, h);
printf("%d ", *(ptr));
printf("%d ", *(ptr));
}
私の最初は00000010printf("%p ", *(ptr));
を出力します
私の秒では、printf("%p ", *(ptr));
それは0028fc6cを出力します
確かに、最初の値で値を印刷する"%d"
と、2番目の値は適切ではありません。