Question:
What is # in #include in C,C++..?
nikkie T
2006-07-28 12:16:37 UTC
What is # in #include in C,C++..?
Nine answers:
agent-X
2006-07-28 12:38:29 UTC
It's for preprocessing in C/C++. The first stage in compiling a source code it's the pre-processing one. This part is located only at the begining of the code! It usually consists of:



a). include directives (#include "..." or #include <..>) which copies the full content of a file in the current code (the file is usually called a header file, for this reason)



b). define macros (#define max(a,b) a>b?a:b for example), meaning that during the pre-procesing stage each macro call is replaced, in-line, by the corresponding macro definition (in this case if in the code i would type z=max(a,b) the compiler will change max(a,b) with it's definition given above, so it will write z=a>b?a:b )



c). define conditional compilation (which permits having different versions of the source code in the same file). Typically, this is used to customize the program with respect to the compilation platform, the status (work-in-progress/production code), as well as to ensure that header files are only included once.

#ifdef x

...

#else

...

#endif , or



#if x

...

#else

...

#endif
Petro T
2006-07-28 13:06:54 UTC
Syntax



#INCLUDE FileName



Arguments



FileName



Specifies the name of the header file that is merged into the program during compilation.



You can include a path with the header file name. When you include a path with the header file name, Visual FoxPro searches for the header file only in the specified location.



If you do not include a path with the header file name, Visual FoxPro searches for the header file in the default Visual FoxPro directory, and then along the Visual FoxPro path. The Visual FoxPro path is specified with SET PATH.



Remarks



You can create header files containing preprocessor directives and then use #INCLUDE to merge the contents of the header file into a program when the program is compiled. The contents of the header file are inserted into the program during compilation at the point where #INCLUDE appears in the program.



Only the #DEFINE ... #UNDEF and #IF ... #ENDIF preprocessor directives are recognized in a header file. Comments and Visual FoxPro commands included in a header file are ignored.



A program can contain any number of #INCLUDE directives. These directives can appear anywhere within the program. #INCLUDE directives can also appear in header files, allowing you to nest #INCLUDE directives.



Header files typically have an .h extension, although they can have any extension. A Visual FoxPro header file, Foxpro.h, is included. It contains many of the constants described throughout this documentation.
piyush
2006-07-28 12:45:12 UTC
# is the preprocessor directive which commands that the content of file should be included at the time of compilation.



is the header file which contains all input and output functions like scanf(), printf() which are frequently used in c programs.
?
2016-12-10 22:21:56 UTC
Zip. 0. Zilch. Nada. I pay my credit card in finished each month. My pupil very own loan is long because of fact that paid off. i offered a used automobile, paying in finished with reductions. My bike became a recent. the drawback is that i've got not got a house or loan. Oh nicely!
theoden of rohan
2006-07-28 12:23:41 UTC
This is the " Pre-Processor Directive".

Put on top of the code to direct what header files we wish to use.
2006-07-28 12:22:44 UTC
It just signals that a compiler directive is coming up.
2006-07-28 12:19:47 UTC
i forgot
savvy
2006-07-28 12:19:41 UTC
huh?
kt2663
2006-07-28 12:19:34 UTC
WHAT?


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...