@xy36 is right, and this error can`t be reproduced with the code posted. But, if you need a list, you can use the code bellow. I just improved a little your code. About the var LED_GREEN, if you want to change it's value, I sugget you to change the code inside the function addNode. If you are using an embbed board, like arduino, just check your wires connections and don't forget to use the command "digitalWrite(pin, value);" to change you led value.
Good luck.
#include <stdio.h>
#include <stdlib.h>
struct node{
int ID;
int value;
struct node *next;
};
int LED_GREEN = 0;
struct node * addNode(struct node *conductor, int value){
struct node * newNode;
newNode = (struct node *)malloc(sizeof(struct node));
newNode->value = value;
newNode->ID = conductor->ID + 1;
conductor->next = newNode;
newNode->next = NULL;
printf("Node added.\n");
return newNode;
}
void printList(struct node *root){
struct node *conductor = NULL;
conductor = root;
while(conductor){
printf("Node[%d] value: %d. \n",conductor->ID, conductor->value);
conductor = conductor->next;
}
return;
}
int main()
{
struct node *root =NULL;
struct node *conductor = NULL;
if(!root){
root = (struct node *)malloc(sizeof(struct node));
root->next = 0;
conductor = root;
root->value = 1;
root->ID = 0;
}
conductor = addNode(conductor, 3);
conductor = addNode(conductor, 5);
conductor = addNode(conductor, 7);
conductor = addNode(conductor, 11);
conductor = addNode(conductor, 13);
printList(root);
return 0;
}