Discussion :: C Preprocessor - Yes / No Questions (Q.No.7)
|Tim said: (Dec 7, 2010)|
|Your answer depends on the CONTENTS of the header file. For example, a header file that is EMPTY can be included as many times as you like!|
|Chetana said: (Mar 18, 2011)|
|Dont you think your explaination & Answer are differ. Please reply.|
|Pruthvi said: (Sep 17, 2011)|
|Can any one tel me what will b the error if we include an header file twice. ? as the linker will link to any of the headerfiles function then how the error comes. ?|
|Saravanan A said: (Dec 1, 2011)|
|Yes its very much dependent on the content. If only extern function declarations and extern variable declarations are there it will not be a issue. Only if some types are defined like structure - redefinition error will come. Or if a variable if defined which is a rare case though.|
|Onkar said: (Jan 25, 2012)|
|I didn't get it please explain it again in simple words.|
|George said: (Jan 8, 2013)|
|It depends in the header file. If there are inclusion guards, then it should be OK.
Once the header is a called a second time, #ifndef __STDIO_H__ will evaluate to FALSE.
|Gurunath said: (Dec 18, 2014)|
|We don't understand clearly.|
|Vjay said: (Jun 11, 2017)|
|#define calc(a,b) (a*b)/(a-b)
What will be the answer? Please tell me.
Post your comments here:
Email : (optional)
» Your comments will be displayed only after manual approval.