This code is supposed to insert a given int after and a given int before a linked list. However, when I pass the arguments in main, they do not store the values in commands insAfter and insBefore, and just return 0. I am guessing it has to do with the integer, but when I had the user input the value in the actual function and set it to the same thing "n" is set to and it worked.
struct node {
  int data;
  char *item;
  struct node* next;
};
struct node* root = NULL;
void insAfter();
void insBefore();
//Main
void main () {
}
//Command Insert After
void insAfter(int n) {
  struct node* temp;
  temp = (struct node*)malloc(sizeof(struct node));
  n = temp->data;
  temp->next = NULL;
  if(root==NULL) {
    root = temp;
    printf("Text inserted at beginning\n");
  }
  else {
    struct node* p;
    p = root;
    while(p->next != NULL) {
      p = p->next;
    }
    p->next = temp;
      printf("Ok\n");
  }
}
//Command Insert Before
void insBefore(int n) {
  struct node* temp;
  temp = (struct node*)malloc(sizeof(struct node));
  n = temp->data;
  temp->next=NULL;
  if (root == NULL) {
    root = temp;
    printf("Text inserted at beginning\n");
    fflush(stdout);
  }
  else {
    temp->next=root;
    root = temp;
    printf("Ok\n");
    fflush(stdout) ;
  }
}
