I am currently implementing a linked list that will store an array of strings in each node. Currently I am trying to return those array of strings to main. Code for the structure is
#define MAX_LINE 80
typedef struct node
{
char things[MAX_LINE/2][MAX_LINE];
struct node *link;
}Node;
and the method in question is
char **getThings(Node *head, int position){
if(position == 1){
return head->things;
}
int i = 1;
while(head->link != NULL){
head = head->link;
i++;
if(i == position){
return head->things;
}
}
{
However, the error is a "warning: return from incompatible pointer type. I have looked over returning arrays in C and dynamic allocation but have not been able to understand it in relation to linked list access. Should each of the elements in things be taken out and put into a dynamically allocated array and if so how?