মডুলার C প্রোগ্রামিং (Modular C Programming)
- Read more about মডুলার C প্রোগ্রামিং (Modular C Programming)
- Log in or register to post comments
- 366 views
Programming Style
In this section, I'd like to briefly highlight some points that will help you write clean programs that can easily be read, understood, and maintained.
To help solidify your understanding of this hour's lesson, you are encouraged to answer the quiz questions and finish the exercises provided in the Workshop before you move to the next lesson.
Q Is the C preprocessor part of the C compiler?
A No. The C preprocessor is not part of the C compiler. With its own line-oriented grammar and syntax, the C preprocessor runs before the compiler in order to handle named constants, macros, and inclusion of files.
Compiling Your Code Under Conditions
You can select portions of your C program that you want to compile by using a set of preprocessor directives. This is useful, especially when you're testing a piece of new code or debugging a portion of code.
The #define and #undef Directives
The #define directive is the most common preprocessor directive, which tells the preprocessor to replace every occurrence of a particular character string (that is, a macro name) with a specified value (that is, a macro body).
The C Preprocessor Versus the Compiler
One important thing you need to remember is that the C preprocessor is not part of the C compiler.
If there is a constant appearing in several places in your program, it's a good idea to associate a symbolic name to the constant, and then use the symbolic name to replace the constant throughout the program. There are two advantages to doing so. First, your program will be more readable.
To help solidify your understanding of this hour's lesson, you are encouraged to answer the quiz questions and finish the exercises provided in the Workshop before you move to the next lesson.
Q Why is random access to a disk file necessary?