You can include a file with the #include directive at any place you want to. You just have to consider that the compiler will see the total source file as if you had copied the contents of each include file at the point where you included it, and it will parse and process the total source file accordingly.
That said, header files, a subset of included files, are generally #include'd at the top of the source file. Again, it all depends on what is in the include file.
If you wanted to ask whether an #included file can contain other #include directives, then the answer is yes.
Include files are also known as header files.
#include <fstream>
You can use header files (more specifically "include" files) anywhere in a program. You just have to consider what type of statements, declarative or definitive, there are in the include file, and what your effective scope is. That is why they are generally at the top.
There is no system header called share.h, but if there were, it would be: #include <share.h>
Yes,we can compile our program without header file without any error,but we can not use any predefine functions like printf,scanf.
#include or#include "nameoftheader"
Include files are also known as header files.
C programs do not require header files. If you want a C program without header files, you can simply not create them. However, you may or may not be able to include your non-header file source files.
Classes and structures can be put in a header file the same way you would use them in a main program; the only difference is that they are placed in a separate file, called a header file. Then, after creating a new file, include that new file with the definition by the use of the preprocessor #include statement.
#include <fstream>
You can use header files (more specifically "include" files) anywhere in a program. You just have to consider what type of statements, declarative or definitive, there are in the include file, and what your effective scope is. That is why they are generally at the top.
There is no system header called share.h, but if there were, it would be: #include <share.h>
Header files are not much different from usual cpp files. There are basically two different things. It's file extension: you need to choose "header file" when you create it or save as .h file. Second is header files do not have main() function. When you are done with you header file do not forger to include it in your project by writing preprocessor directive:#include "your_header_file.h"
You can include it into your source.
# include <stdio.h>
#include <stdio.h>
Yes,we can compile our program without header file without any error,but we can not use any predefine functions like printf,scanf.