CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Why use #define?

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By `e`

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 22, 2015, 02:44
Default Why use #define?
  #1
New Member
 
Join Date: Apr 2015
Posts: 16
Rep Power: 11
why? is on a distinguished road
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?
why? is offline   Reply With Quote

Old   April 22, 2015, 05:35
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
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.
aestas and why? like this.
`e` is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 15:08.