First, do not define variables in the headers. Use the extern qualifier when declaring a variable in the header file and define it in one (not both) of your C files or in your own new file if you prefer.
Title:
extern char c;
implementation:
#include <header.h> char c = 0;
Alternatively, you can leave the definition in the header, but add static . Using static will lead to a different program than using extern , as in the example above, so be careful. If you make it static , each file containing the header will receive its own copy of c . If you use extern , they will use one copy.
Secondly, use protection against double inclusion:
#ifndef HEADER_H #define HEADER_H ... header file contents ... #endif
source share