This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Link List

xdata struct EEPROM {

unsigned int Last_Data; struct EEPROM *Node; };

struct EEPROM xdata * xdata p; p = (struct EEPROM xdata *)0x0FF6;
if i will print the following statement
printf("Size of p = %d",(unsigned int)sizeof(*p));

then it will shows the 5,but actually it should show the 4 bytes

Parents
  • "The link list is a very ineffective means of storing stuff"

    Not necessarily.
    Linked lists are particularly useful when your data needs to be easily re-ordered without copying it.

    no more useful than re-ordering pointers in an array

    "require 'unlimited' memory"
    Completely untrue!
    As previously discussed, statically-allocated linked lists are perfectly common.

    if open-ended is not a desire, then using a linked list becomes even more silly.

    "other than 'It is easy'"
    Surely that could be an entirely valid reason?

    1) easier than what
    2) "It is easy'" is thr most often used excuse for writing ineffective code.

    Just mentally go through the process of getting to the last entry in a linked list as opposed to getting to the last entry in an array of pointers. Point taken?

    Erik

Reply
  • "The link list is a very ineffective means of storing stuff"

    Not necessarily.
    Linked lists are particularly useful when your data needs to be easily re-ordered without copying it.

    no more useful than re-ordering pointers in an array

    "require 'unlimited' memory"
    Completely untrue!
    As previously discussed, statically-allocated linked lists are perfectly common.

    if open-ended is not a desire, then using a linked list becomes even more silly.

    "other than 'It is easy'"
    Surely that could be an entirely valid reason?

    1) easier than what
    2) "It is easy'" is thr most often used excuse for writing ineffective code.

    Just mentally go through the process of getting to the last entry in a linked list as opposed to getting to the last entry in an array of pointers. Point taken?

    Erik

Children
No data