I am aware of how to use pointers in order to point to other objects such as arrays, but in the scheme of knowing how to use them in linked lists, I am confused. For Example:
struct node {
int info;
struct node *next;
}
typedef struct node Node
And assume that later on in the program, dataList is set to the address of the first node of a list that holds these data in this order: 25,30,45,60,65,80,90
I am to write C statements that set ptr1 to the address of the node holding 45 and set ptr2 to the address of the node holding 80.
Given that dataList is initially the head of the list, my idea was:
ptr1= dataList.next.next
but I am sure that is incorrect formatting or I also thought that
ptr1->next->next
might be correct, but again, I am not sure.
ptr1= dataList->next->next,Assuming dataList is the pointer to the head element.