(ネットビーンズで開発している私の問題の簡略版)
私はこの構造体を定義しています:
typedef struct data_info
{
unsigned int* array; //containing ints at hex base
int x;
}data;
そして、メイン関数で私はこれらをやっています:
data *d = malloc(sizeof(data);
d->array = malloc(4*sizeof(unsigned int));
この構造体を使用した後、メモリの割り当てを解除したいと思います。私は netbeans デバッグで変数の状態を見ています:
address of (d->array) -> 0x605670
free(d->array); //makes the array NULL
d->array = NULL;
free(d); //makes the pointer not NULL - adress is 0x605500
また、配列の状態は次のとおりです (16 進値):
d->array[0] = 0
d->array[1] = 0
d->array[2] = 31
d->array[3] = 0
d->array がアドレス値を取得するのはなぜですか?