M
mdh
K&R briefly mention splitting programs into seperate files.(page 82)
Using my compiler (X-code) I noticed that creating a header file
gives, as expected one .h file, but creating a new ".c" file creates
an additional file, same name, but with an ".h" extension, and calls
this an optional header file.
Compiling the program using both the .c and .h ( with appropriate
#includes) executes successfully. In K&R, .h files were used to
centralize declarations, etc, and each .c file was used to define
functions etc.
Could anyone explain what is happening here, and perhaps suggest good
usage? ( I looked at the FAQ, and unless I missed it, I did not see
this addressed.)
As usual, thanks in advance.
Using my compiler (X-code) I noticed that creating a header file
gives, as expected one .h file, but creating a new ".c" file creates
an additional file, same name, but with an ".h" extension, and calls
this an optional header file.
Compiling the program using both the .c and .h ( with appropriate
#includes) executes successfully. In K&R, .h files were used to
centralize declarations, etc, and each .c file was used to define
functions etc.
Could anyone explain what is happening here, and perhaps suggest good
usage? ( I looked at the FAQ, and unless I missed it, I did not see
this addressed.)
As usual, thanks in advance.