Hi, I have a program that I just wrote, but really its just a program that will be used by a larger program that I am working on. The larger program will run some functions in the small program, accessing some of its global arrays/variables to extract information.
I never knew how to create a header file so that this large program can include it. I think what i use to do was just "include small_prog.c" but I know thats not correct.
So how do we go about creating a header file?
The small program basically has:
-1 global array variable pointer
-3-4 int variables
- includes math.h, time.h, stdio.h, stdlib.h ctype.h
- #define MAX_ARRAY_SIZE 100
- a main function (only used if your running the file on its own)
- several functions that perform instructions to modify the above variables.
an example of this could be:
----------------------------------
small_prog.c
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include <time.h>
#define MAX_ARRAY_LENGTH 100
int* matrix_array;
int dimension=0;
int matrix_mode=0;
int x = 0;
void func1 (int x);
float func2 (float y);
int func3 (char a);
int main(int argc, char* argv[])
{
....
.
.
and so on
----------------------------------
So I want to include this small program in a large program, by refering to a .h file. but what do i write in the h file?
Jenna