Hey guys... can anyone help me with the header files ? I mean how to make a header file and use it in the source file...
For example if you want to hook up function such:
you need to:
1) make a file math.h and declare there your function:
|
extern int sum(int a, int b);
|
2)write implementation of your function in file math.c:
1 2 3 4 5 6
|
#include "math.h"
int math(int a, int b)
{
.....
}
|
3) Use this function in your main.c file
1 2 3 4 5 6 7 8
|
#indluce <stdlib.h>
#indluce <stdio.h>
#include "math.h"
int main ()
{
math(a,b);
}
|
That is all :-)
Last edited on
@SimpleIce You still have to include "math.h" in your main.c file.
I wouldn't name a header with a standard library name.
@GodPyro Thanks for prompt. I corrected mistake.
@filipe It's just a example and nothing more :-)