|
[Sponsors] |
April 22, 2015, 02:44 |
Why use #define?
|
#1 |
New Member
Join Date: Apr 2015
Posts: 16
Rep Power: 11 |
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?
|
|
April 22, 2015, 05:35 |
|
#2 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
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.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
HELP----Surface Reaction UDF | Ashi | Fluent UDF and Scheme Programming | 1 | May 19, 2020 22:13 |
Installing OF 1.6 on Mac OS X | gschaider | OpenFOAM Installation | 129 | June 19, 2010 10:23 |
Missing math.h header | Travis | FLUENT | 4 | January 15, 2009 12:48 |
Free surface boudary conditions with SOLA-VOF | Fan | Main CFD Forum | 10 | September 9, 2006 13:24 |
UDF FOR UNSTEADY TIME STEP | mayur | FLUENT | 3 | August 9, 2006 11:19 |