|Access||Adobe photoshop||Algoritmi||Autocad||Baze de date||C||C sharp|
|Calculatoare||Corel draw||Dot net||Excel||Fox pro||Frontpage||Hardware|
|Php||Power point||Retele calculatoare||Sql||Tutorials||Webdesign||Windows|
|Asp||Autocad||C||Dot net||Excel||Fox pro||Html||Java|
The first statement in the example is a preprocessor directive. In days gone by, the C compiler used to have two phases: the preprocessor, followed by the real compiler. The preprocessor was a macro processor, whose job was to perform simple textual manipulation of the program before passing the modified text on to be compiled. The preprocessor rapidly became seen as an essential aspect of the compiler and so has now been defined as part of the language and cannot be bypassed.
The preprocessor only knows about lines of text; unlike the rest of the language it is
sensitive to the end of a line and though it is possible to write multi-line
preprocessor directives, they are uncommon and a source of some wonder when
they are found. Any line whose first visible character is
# is a
In Example 1.1 the preprocessor directive
#include causes the line containing it to be replaced
completely by the contents of another file. In this case the filename is found
> brackets. This is a widely used
technique to incorporate the text of standard header files into your
program without having to go through the effort of typing it all yourself. The
<stdio.h> file is an important
one, containing the necessary information that allows you to use the standard
library for input and output. If you want to use the I/O library you must include
<stdio.h>. Old C was more relaxed
on this point.
Another of the preprocessor's talents which is widely exploited is the
#define statement. It is used like this:
which says that the name represented by
IDENTIFIER will be replaced by the text
of replacement whenever
occurs in the program text. Invariably, the identifier is a name in upper-case;
this is a stylistic convention that helps the reader to understand what is
going on. The replacement part can be any text at allóremember the preprocessor
doesn't know C, it just works on text. The most common use of the
statement is to declare names for constant numbers:
and to use them like thiscircumf = 2*PI*radius;
the output from the preprocessor will be as if you had written this:circumf = 2*3.141592*radius;
Preprocessor statements work on a line-by-line basis, the rest of C does not.
#include statements are
used to read the contents of a specified file, typically to facilitate the use
of library functions.
statements are typically used to give names for constants. By convention, the
names are in upper case (capitalized).
Politica de confidentialitate|
Adauga cod HTML in site