#include is one of kind of preprosesor directive. This preprosesor directive is used to read file which contain function declaration and constants definition. Some title files is available in C. These files have characterristic, that is its name ended by .h extension. Example on program, #include >float.h< declares on compiler so that read file named float.h when compilation
Example:
Program syntax to know the largest value of float variable is:
printf("%g", FLT_MAX)
If made in full program then program syntax will becomes:
main()
{
printf("%f", FLT_MAX);
getch();
}
But when program is run will occur ERROR, because value of FLT_MAX constant is in float.h file, so that to know value of FLT_MAX constant then compiler must read file named float.h. And if added #include <float.h> so that program syntax becomes:
#include <float.h>
main()
{
printf("%f", FLT_MAX);
getch();
}
then program can be run and know value of FLT_MAX constant. Usually .h files are in software installation folder > C > include
Source:
File from lecturer.eepis-its.edu
Example:
Program syntax to know the largest value of float variable is:
printf("%g", FLT_MAX)
If made in full program then program syntax will becomes:
main()
{
printf("%f", FLT_MAX);
getch();
}
But when program is run will occur ERROR, because value of FLT_MAX constant is in float.h file, so that to know value of FLT_MAX constant then compiler must read file named float.h. And if added #include <float.h> so that program syntax becomes:
#include <float.h>
main()
{
printf("%f", FLT_MAX);
getch();
}
then program can be run and know value of FLT_MAX constant. Usually .h files are in software installation folder > C > include
Source:
File from lecturer.eepis-its.edu
0 komentar:
Posting Komentar