Good day to whoever reads this
OS: Linux Mint 10 Julia
IDE: Codeblocks 10.05 with GNU GCC as compiler
The program is working when in one single file but an error surfaces when it is divided into separate files namely: program.c, mylib.h and create.c
I removed other functions so I could experiment with only one but still
andCode:void create(PTR_NODE *HEAD)
does not do the trick in the header file..Code:void create(PTR_NODE *)
Small portion of the program:
Any response will be appreciated.Code:// Code in program.c #include <stdio.h> #include <stdlib.h> #include <string.h> #include <mylib.h> //my user-defined header struct node //this is the struct of a node { int data; struct list *link; }; typedef struct node NODE; //NODE is declared with a format of struct node containing elements data and link typedef NODE *PTR_NODE; //this declaration confuses me... //the declared NODE is used as a type for another declaration but of pointer //PTR_NDOE works fine in declaring the head and tail for the linked list int main() { PTR_NODE head = NULL; //declare and initialize head //Other code create(&head); //in order to create a node, function must know what is head } // Code in mylib.h void create(PTR_NODE *HEAD) //this (pass by reference?) does not work when linked in separate files (program.c, mylib.c and create.c) //error says: expected ')' before '*' token // Code in create.c void create(PTR_NDOE *HEAD){ PTR_NODE local_variable_head; //declare local_variable_head = *HEAD; //copy contents //create a node }