I have large main file contains about 7,000 lines of C code. If I want to make this code modular and separate the code from this file. what is the main criteria for separating the functions out of the file and functions that should stay in the file.
Share
I like to use a top-down decomposition of the code. For example:
The
main()should be short and to the point and give you a quick overview of what the program does from a high-level. Each of these functions can be broken down in a similar way. This should continue until the lowest level functions have a single, focused purpose (logical modularity). These functions can be put into additional .c/.h files to have physical modularity.Good luck!