Search:

Type: Posts; User: Lax

Search: Search took 0.00 seconds.

  1. Replies
    33
    Views
    25,251

    I can't thank you enough! Your help has been...

    I can't thank you enough! Your help has been invaluble for me to actually understand this whole ordeal. I really appreciate that you made me conceptualize the problem. I really feel like drawing out...
  2. Replies
    33
    Views
    25,251

    Okay Im getting it to work!! This is how the code...

    Okay Im getting it to work!! This is how the code looks like now:


    #include "stdio.h"
    #include "stdlib.h"


    typedef struct node
    {
    struct node *prev;
  3. Replies
    33
    Views
    25,251

    Also this might be a pointer arthmetic question,...

    Also this might be a pointer arthmetic question, but how would I access the next pointer of the node before the one im inserting. I assume it I would do it by using the tail pointer before I...
  4. Replies
    33
    Views
    25,251

    Okay I see but just to be sure: This node->prev =...

    Okay I see but just to be sure: This node->prev = list->tail does establish this connection : Screenshot - de7495e8b6eb0a7764d9f138c3413d09 - Gyazo (the one the red arrow is pointing at) if it is...
  5. Replies
    33
    Views
    25,251

    Yea that is true. I actually tested myself and...

    Yea that is true. I actually tested myself and when I saw that I only got a 6 from my printlist I thought it was because the head pointer didnt change so I just changed the list->head to list->tail...
  6. Replies
    33
    Views
    25,251

    Oh I think by sheer coincidence I wrote my most...

    Oh I think by sheer coincidence I wrote my most recent message just as you posted this reply. I think I managed to understand and implement it.
  7. Replies
    33
    Views
    25,251

    I COME BEARING GOOD NEWS!!! So after taking...

    I COME BEARING GOOD NEWS!!!

    So after taking what you said to heart I tried to implement my foundings I wrote in my two most recent posts.... AND IT WAS A SUCCES!!

    This is what my current code...
  8. Replies
    33
    Views
    25,251

    Here is another attempt. (I'll go with my...

    Here is another attempt. (I'll go with my intuition here but with your feedback in mind)

    first line https://gyazo.com/e7acefb1141b33d7d31bd662ed9c0ed1 now the prev pointer is pointing to a NULL...
  9. Replies
    33
    Views
    25,251

    Oh this makes sense I will have another go at...

    Oh this makes sense I will have another go at this.



    Ah I see so node->prev = list->tail; makes the prev pointer of the that node point to whatever the list points at.



    I don't really...
  10. Replies
    33
    Views
    25,251

    I Totally missed these replies. This does give me...

    I Totally missed these replies. This does give me some more context. If I would redraw the steps again it would look this in my mind:

    We start like this again: Screenshot -...
  11. Replies
    33
    Views
    25,251

    Thank you for such a wonderful reply! Im so...

    Thank you for such a wonderful reply! Im so thankful you are trying to get me to understand the core concept instead of just giving me the answer, I really do so thanks a ton!

    I followed your...
  12. Replies
    33
    Views
    25,251

    Here is the InsertTail int...

    Here is the InsertTail



    int insertTail(list_t *list, node_t *node)
    {
    node->prev = list->tail;
    node->next = NULL;
    list->tail = node;
  13. Replies
    33
    Views
    25,251

    Yea that makes sense. I have seen plenty other...

    Yea that makes sense. I have seen plenty other examples where that solution is used.

    If I may ask, is my previous assumptions correct? I feel like there is still something wrong with either my...
  14. Replies
    33
    Views
    25,251

    So I compiled what I wrote and while I didnt get...

    So I compiled what I wrote and while I didnt get any errors after some fixes.
    This is what I got so far:


    node->prev = list->tail; // Copies the adress of the tail of the previous node into the...
  15. Replies
    33
    Views
    25,251

    A right that makes sense since they are not the...

    A right that makes sense since they are not the sama data type. I have to be honest here all these pointers are a bit confusing to me but asking these question is really making it easier for me to...
  16. Replies
    33
    Views
    25,251

    I have now made a couple of changes to my program...

    I have now made a couple of changes to my program to try and get a greater understanding of pointers, aswell as memory allocation. I have now implemented a previous pointer to make it a doubly linked...
  17. Replies
    33
    Views
    25,251

    Thanks for the reply! Ohh I see that makes...

    Thanks for the reply!

    Ohh I see that makes sense. So if I would like to acess that point in memory, (but not dereference) I would just store the adress in another variable?


    list_t *list2;...
  18. Replies
    33
    Views
    25,251

    After thinking things through a bit there is...

    After thinking things through a bit there is something here I dont quite fully understand.
    This bit here:


    list_t *createList(void)
    {
    list_t *list = malloc(sizeof(*list));
    if (list)...
  19. Replies
    33
    Views
    25,251

    Thank you so much for this. This cleared a lot...

    Thank you so much for this. This cleared a lot that I was confused about. What you said about memory leak really made a lot of sense to me. I really appreciate that you took the time to explain this...
  20. Replies
    33
    Views
    25,251

    Memory adress as output

    Hello,

    I'm trying to implement an insert function to my linked list but when I try to print the values I only get what I assume is memory adresses. Why is this the case? I have also noticed that...
  21. Replies
    2
    Views
    4,101

    Oh that do make a lot of sense! Thank you for...

    Oh that do make a lot of sense! Thank you for taking the time to answer :)!
  22. Replies
    2
    Views
    4,101

    Question regarding linked list

    Hello!

    So I'm currently just experimenting with linked lists to get a better understanding of it aswell as on pointers. However, I'm afraid there is something im missing. I'll just post my code...
Results 1 to 22 of 22