문제

I have a struct that contains two pointers, < head, iterator > both pointers point to another struct - Node.

typedef struct Map_t {

    Node head;
    Node iterator;

} Map_t;

typedef struct Node_t* Node;

struct Node_t {
    MapDataElement Data;
    MapKeyElement Key;

    struct Node_t *next;
};

typedef struct Map_t *Map;

I want to make the iterator pointer point to the same position as head. heres Debbuging before and after runnning the line:

Before line enter image description here

After line enter image description here

As you can see, after running the line, the map->iterator still points to 0x0.. Why is that?

도움이 되었습니까?

해결책

It appears that the pointer assignment has occurred as evidenced by your second picture, which highlights the changes to the members of map->iterator. I'd imagine the method runs to completion, returning the pointer 0x9918f0.

This leads me to believe that you're not actually experiencing a failure in pointer assignment, but merely a failure in your debugger (Eclipse) displaying an updated value. This could be due to a bug in Eclipse or it could be due to insufficient debugging information available to Eclipse. It is difficult to say with only the example given.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top