G
G Patel
Hello,
If a program has two source files: main.c secondaryfunctions.c
and I have a header file: secondaryfunctions.h (with prototypes for the
function)
The only function in main.c is main() and it requires certain headers
(because it uses certain library functions). I added the headers
associated with the library functions at the top of main.c and I added
my custom header file for the secondary function.
The functions in secondaryfunctions.c also require the same library
functions as does main. Do I need to include the same headers in
secondaryfunctions.c? I have not done this because I figure when the
linker adds secondaryfunctions.c to the main program, the headers
within main.c will provide the prototypes to everything. My program
works as expected, but I'm not sure if it was an accident or whether my
line of thinking is accurate. So which is it?
Big thanks in advance
If a program has two source files: main.c secondaryfunctions.c
and I have a header file: secondaryfunctions.h (with prototypes for the
function)
The only function in main.c is main() and it requires certain headers
(because it uses certain library functions). I added the headers
associated with the library functions at the top of main.c and I added
my custom header file for the secondary function.
The functions in secondaryfunctions.c also require the same library
functions as does main. Do I need to include the same headers in
secondaryfunctions.c? I have not done this because I figure when the
linker adds secondaryfunctions.c to the main program, the headers
within main.c will provide the prototypes to everything. My program
works as expected, but I'm not sure if it was an accident or whether my
line of thinking is accurate. So which is it?
Big thanks in advance