A header guard is used to make sure that when including our .h file, even if that .h file is included multiple times it will only declare its functions once.
What are the header guards used to prevent file from being repeated by the preprocessor?
- #ifndef
- #define
- #endif
What is coupling?
the degree of reliance on other modules/functions. higher coupling = higher dependency
What is cohesion?
the degree to which a function adheres to 1 task, low cohesion = doing many independent tasks
In a well design module, it should have?
low coupling and high cohesion
What does static mean in C program?
static functions make it so it can only be called within the same file it's declared in. essentially similar to private methods in Java
Should we or should we not share data between files? Why?
no, bad design and exposes our implementation. it leads to high coupling