I really want to know right way of using header file.
Belows are two ways of using header file which i think either of them is good way.
notice : Destroy.c also use stdio.h, stdlib.h
1.
2.
Please advice me. Thanks
Do not establish unnecessary dependencies!
There is no need to include any system headers into destroy.h
. If needed by code in destroy.c
include them there.
Include system/library headers 1st. There are very rare conditions to not stick to this rule.
Update on why inlcude system header 1st:
The system headers declare the "frame-work" the program wants to use. So the program should "know" about this "frame-work" before declaring its own stuff, as it might rely on what the system provides.
The systen mostly never relies on what the program provides.
Same for libraries, from the program's perspective, those are just additions to the system.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With