for(N = List->Head;N;N = N->Succ)

struct NODE{
    struct NODE Succ;
    struct NODE Prev;
};

struct LIST{
    struct NODE *Head;
    struct NODE *Tail;
    int count;
};

struct LIST *List;
struct NODE *N;

......
for(N = List->Head;N;N = N->Succ)
{
    ......
}
Compiler C51 changed value of List->Head because of the side effect of N = N->Succ.What can I do?

Parents
  • Your report is crucially incomplete. How do you detect that something happened to List->Head? There's not even a vague hint of actual results of running this code in your posting.

    And what side effect of

    N=N->Succ
    would that be supposed to be? Because, by my book, there is none to be seen in there.

    And to top it all off, there's a potentially fatal typo in your quoted source code snippet:

    struct NODE{
         struct NODE Succ;  // should be *Succ
         struct NODE Prev;  // should be *Prev
    };
    

Reply
  • Your report is crucially incomplete. How do you detect that something happened to List->Head? There's not even a vague hint of actual results of running this code in your posting.

    And what side effect of

    N=N->Succ
    would that be supposed to be? Because, by my book, there is none to be seen in there.

    And to top it all off, there's a potentially fatal typo in your quoted source code snippet:

    struct NODE{
         struct NODE Succ;  // should be *Succ
         struct NODE Prev;  // should be *Prev
    };
    

Children
More questions in this forum