I am making a program that needs to make an array of linked list, but I keep getting an error that says dereferencing pointer to incomplete type at the point when I am trying to set value to temp. My code is:
Code:
#include <stdio.h>
#include <stdbool.h>
typedef struct //list node
{
char destination;
struct NODE* next;
}NODE;
typedef struct //linked list
{
char startingPoint;
struct NODE* first;
}LIST;
void fillStruct(char* fileName,LIST map[]);
void printList();
void depthSearch();
void breadth();
void topoSort();
NODE* ListIterator(NODE* start);
void fillStruct(char* fileName,LIST map[]){
char points[60];
FILE* fpIn;
int i=0;
char readIn=' ';
int j=0;
struct NODE* temp;
for(j=0;j<60;j++)
points[j]=' ';
if((fpIn=fopen(fileName,"r"))!=NULL)
do{
readIn=getc(fpIn);
if(readIn!=EOF && readIn>='A')
points[i++]=readIn;
}while(readIn<'A' && readIn!=EOF);
for(j=0;points[j]!=' ';j+=2){
if(map[(int)points[j]-65].startingPoint==' ')
map[(int)points[j]-65].startingPoint=points[j];
temp->destination=points[j+1];
temp->next=NULL;
if(map[(int)points[j]-65].first==NULL)
map[(int)points[j]-65].first=temp;
else{
ListIterator(map[(int)points[j]-65].first)->next=temp;
//last->next=temp;
}
}
I know the structure declarations may look a little weird, but that is how my compiler requires them. Any help on what is wrong with my code will be greatly appreciated.