“We write a .h file for every module in our design” what is the module referring to?
and when do we write a separate .c file?
We write a .h file for every module in our design what is the
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It is generally a good idea to declare one class per header (.h or .hpp) and implement its content in one .cpp file. In case of C, you group the functions by what they do or the context they are used in and also declare them in one header and implement in one .c file. For instance: math, such as square roots, trigonometry stuff (sine, cosine, tangent), powers, perhaps also min/max functions (although they’re beter off as macros in most cases) would reside in their very own .h/.c or .hpp/.cpp pair of files.
Of course, you can ignore this completely and stuff all your code in a single .c(pp) file, no header at all. It’ll just become completely unreadable :).