CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Why use #define? (https://www.cfd-online.com/Forums/fluent-udf/152007-why-use-define.html)

why? April 22, 2015 01:44

Why use #define?
 
What is the use of using #define and defining a value when I can just put in the value when it is needed in my code. Isn't it just an extra line doing nothing in particular?

`e` April 22, 2015 04:35

Possibly, but consider readability and user-friendly code. If you're using a particular value many times throughout your code, for example an important geometry length (diameter of a pipe), and would like to adjust this value then you only need to alter the value in one convenient location (top of the document) instead of throughout your code.


All times are GMT -4. The time now is 04:19.