How to declare global variables and functions defined in a C program file with ease

  • Programming practice of C programmers:

      • For each C program file named myProgFile.c:

          • Create a corresponding header file named myProgFile.h

      • The header file myProgFile.h contains the declarations of:

          1. All the global variables defined in myProgFile.c

          2. All the functions defined in myProgFile.c

      • #Include myProgFile.h in:

          1. myProgFile.c (to verify the declarations in myProgFile.h)    and

          2. Any C program file that uses a global variable or a function defined in myProgFile.c