Categories:
.NET (357)
C (330)
C++ (184)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (2)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
Using Macros for Contants
What is the benefit of using #define to declare a constant?
✍: FYIcenter
Using the #define method of declaring a constant enables you to declare a constant in one place and use it throughout your program. This helps make your programs more maintainable, because you need to maintain only the #define statement and not several instances of individual constants throughout your program.
For instance, if your program used the value of pi (approximately 3.14159) several times, you might want to declare a constant for pi as follows:
#define PI 3.14159
Using the #define method of declaring a constant is probably the most familiar way of declaring constants to traditional C programmers. Besides being the most common method of declaring constants, it also takes up the least memory. Constants defined in this manner are simply placed directly into your source code, with no variable space allocated in memory. Unfortunately, this is one reason why most debuggers cannot inspect constants created using the #define method.
2007-02-26, 7671👍, 0💬
Popular Posts:
How do we host a WCF service in IIS? Note: - The best to know how to host a WCF in IIS is by doing a...
Give me the example of SRS and FRS SRS :- Software Requirement Specification BRS :- Basic Requiremen...
How can you implement MVC pattern in ASP.NET? The main purpose using MVC pattern is to decouple the ...
How to convert a Unix timestamp to a Win32 FILETIME or SYSTEMTIME? The following function converts a...
I have 5 questions please give me the answer ,explanation,suggestions if any?? what is PMP(project m...