Interesting Problems with the Compiler and Linker

Alright, I was programming and found the need to use a function pointer, I programmed it alright, my syntax was right, but the linker said it was being declared multipally. Well, I found a different way to program it, and just went on. I had this same problem trying to declare variables in header files too(I declared the function pointer in the header too).
Can anyone shed any light as to why it’s complaining about this? I am really bad at figuring out linker problems, I have a mental block or something with them.

Never declare variables in header files (.h), otherwise, everytime you include that header file you’ll be ordering the compiler to declare the variable all over again. That’s why you see those “multiply defined” errors.

In the header file use:

extern char myvariable;

Then really declare the variable as a global only in one of your .c files.

There is an alternative way to declare variables in a header file that involves a conditional compile:

    char myvariable;
    extern char myvariable;

And in one (and only one) .c file

    #include that_header_file.h

I was going to put those variables into structs, because they all had something to do with each other, but the compiler/linker said the same thing about my defined struct.