#include "glob.h"
struct myStruct {
char arr[LEN];
struct myStruct *next;
};
struct myStruct *head = NULL;
void someFunction() { // this function creates the linked list of myStruct
// and *head is the head node
}
test.c
1 2 3 4 5 6 7 8 9 10 11 12
#include "glob.h"
void testFunction() {
// from here I am calling someFunction() to create the Linked List
}
void printFunction() {
// here I am trying to print the list using *head in glob.h
}
The compilation error I am getting is dereferencing pointer to incomplete type
Wow, that is so weird. Last night I tried to define struct in my header file and it was complaining about the fact that I had an array size declared in struct. Today, it is working. I was definitely doing something else wrong. Anyways, jsmith, could you please tell me the better way to achieve this. What I am trying to do is,
I want to create a linked list in one file, and access it in another file. That's why I am declaring the struct and head pointer in glob.h