Why Do People Use "#"outline In Turbo C?
Answer:
Perhaps you wonder what we have gained by substituting PI for 3.14159 in our program. Hopefully we hold made program easier to read. Although such a common constant as 3.14159 is easily recognized, in attendance are many instances where a constant does not reveal its purpose so readily. For example, as we will find out later, the phrase "\x1B[C" cause the cursor to move one space to the right. But which would you find easier to understand in the middle of your program, "\x1B[C", or "CURSOR_RIGHT"? Thus, we would use #define directive:
#define CURSOR_RIGHT "\x1B[C"
Then whenever CURSOR_RIGHT appeared in the program, it would automatically be replaced by "\x1B[C" in the past compilation began.
There is another, perhaps more important origin for using the #define directive in this way. Suppose a constant like 3.14159 appears oodles times in your program. Further suppose that you now decide you want an extra place of precision. you requirement to change all instances of 3.14159 to 3.141592. Ordinarily, you would need to step through the program and manually change each occurance of the constant. However, if you have defined 3.14159 to be PI surrounded by a #define directive, you only need to make one modification, in the #define directive itself:
#define PI 3.141592
The change will be made automatically to all occurances of PI until that time compilation begins.
Resolved Questions:
Can anyone please report to me something in the region of the "theft and immoral use...
The 'theft and illegal use of data' is mainly related by large computer systems that are shared by a variety of users. This sort of offense may involve the access of data by illicit users or the unlawful...
What Is An File Transfer Protocol And How Does It Work?
Define what is File Transfer Protocol and explain on how does it work. File Transfer Protocol (FTP) is a network protocol. This protocol is used to transfer data between computers over a gridiron. FTP can exchange files over any Transport control protocol (TCP)....
What Are The Variations Of Rom Chips?
Types of ROM chips. ROM chips (Read Only Memory) are devices designed to hold data in an embedded system. This could be executable code or any other background necessary. Types of ROM are classed by the methods used to add the data to them. There is masked...