This is a discussion on Evaluation of Preprocessor Directive within the C and C++ forums, part of the Programming Talk category; If I have #define defined as #define dividefunc(a,b) a/b and have a function call as dividefun(x+...
|
|||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Evaluation of Preprocessor Directive
If I have #define defined as
#define dividefunc(a,b) a/b and have a function call as dividefun(x+2,y+3); Suppose x=13 and y=2 How will the #define gets evaluated Will it get substituted as dividefun(13+2,2+2) which is equal to dividefun(15,4) and then get divided as 15/4 =4 or will it get evaluated as dividefun(x+2,y+2) x+2/y+2 which is equal to 13+3/2+2 which becomes 13+1+2=16 Kindly let me know how the evaluation takes place |
|
|||
|
It will get evaluated as
dividefun(x+2,y+2) x+2/y+2 which is equal to 13+3/2+2 which becomes 13+1+2=16 This is because whenever a Preprocessor Directive is called the values given in parameters are substituted as such in the calling directive and then only operation takes place. |
![]() |
| Thread Tools | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| trial version winrunner | garima | Testing Tutorials | 4 | 07-10-2007 02:11 AM |
| QuickTest Professional 8.0 QTP Pro CBT Tutorial and Evaluation Copy | admin | Testing Tutorials | 0 | 04-12-2005 04:38 PM |
| comp.lang.c Answers to Frequently Asked Questions (FAQ List) | Steve Summit | Tech FAQ | 0 | 06-01-2004 07:00 AM |