I have a struct as follows
Code:
struct node{
int x;
int y;
node *next_nodex;
}
node r_table[360];
These are delcared globally. I know this is bad but it does initilise everything if declared globally.
I have a function which decides which element in the array.
How would I get to the last element in one of the lists. Is it something like this.
Code:
node *tmp_ptr;
tmp_ptr = &(r_table[table_indx]);
// Goto to end of list
while (tmp_ptr->next_node != NULL)
tmp_ptr = tmp_ptr->next_node;
// Add new node
tmp_ptr->next_node = new(node);
// Step into new node
tmp_ptr = tmp_ptr->next_node;
tmp_ptr->x = x_anchor - col;
tmp_ptr->y = y_anchor - row;
tmp_ptr->next_node = NULL;
Thanks