I have a project file in C where I declare a structure in file.H, and 2 files includes file.h,
the content of .H file:
#ifndef SORT_H
#define SORT_H
struct lnode {
 int data;
 struct lnode *next;
} *head, *visit;
void add(struct lnode **q, int num);
/*typedef struct lnode NODE; */
#endif
++++ Content of ADD.C +++++
#include "SORT.H"
void add(struct lnode **q, int num)
{
     struct lnode *temp;
     temp = *q;
     /* if the list is empty, create first node */
     if(*q == "") {
      *q = malloc(sizeof(struct lnode));
       temp = *q;
     } else {
      /* go to last node */
      while(temp->next != "")
       temp = temp->next;
       /* add node at the end */
       temp->next = malloc(sizeof(struct lnode));
       temp = temp->next;
     }
     /* assign data to the last node */
     temp->data = num;
     temp->next = "";
}
++++ Content of SORT.C ++++
#include "SORT.h"
#include<conio.h>
#include<stdio.h>
void main(){
    struct lnode *newnode = NULL;
    char choice;
    int lim, i = 0, num;
    clrscr();
     /*get max value*/
     printf("Input no. of values: ");
     scanf("%d",&lim);
     for(i = 0; i <= lim; i++){
        printf("[%i] = ",i);
        scanf("%d",&num);
        add(&newnode, num);
     }
    head = newnode;
    for(;;){
        printf("\n\n\nMENU: \n");
        printf("[A]Selection Sort\n[B]Insertion Sort\n[C]Exchange Sort\nChoice: ");
        scanf("%s",&choice);
        switch(toupper(choice)){
            case 'A':
                      clrscr();
                      printf("Selection Sort: \n");
                      break;
            case 'B':
                      clrscr();
                     printf("Insertion Sort: \n");
                      break;
            case 'C':
                      clrscr();
                        printf("Exchange Sort: \n");
                      break;
            case 'D':
                      exit();
                      break;
            default:
                      clrscr();
                      printf("Incorrect choice!\n\n\n");
                      break;
        }
    }
}
And i get the linker_error: _head and _visit is being duplicated from file1.c to file2.c.
and i need this structure in my 2 files, anyway for me to do this, also if you need more information just say so.
 
    