I typedef'd some stuff:
Code:
typedef struct country Country;
struct country {
char name[LENGTH];
int dimen;
int num;
//QTnode *flag;
Country *next;
};
And here is the function that makes the node:
Code:
Country *makeNode(char p[MAXLENGTH]){
int i = 1;
Country *node;
node = (Country*)malloc(sizeof(Country));
strcpy(node->name, p);
getImage(node->name, &node->dimen);
node-> num = i;
node-> next = NULL;
printf("*%d [%d] %s\n", node->num, node->dimen, node->name);
return (node);
}
Suppose the user presses "A", and this function gets activated and the following commands are executed properly. If the user presses "A" again, is this node destroyed and a new one created? If so, how should I go about retaining this node and creating a new node and having a pointer to the new node so that new information is stored there and can be accessed later?
Cheers