Headers are primarily used to separate interfaces from implementations in order to provide modularity and organisation of code. Headers typically contain declarations of related data types, classes and functions while corresponding source files contain the implementations or definitions for those types. The only real exceptions are template functions and classes which must be fully-defined within the header.
By separating the interfaces from the implementations, other source files can make use of those interfaces simply by including the appropriate headers. All headers must use header guards to ensure each is only included once in any compilation.
Headers can also include other headers, however this is only necessary if the header requires access to the interface contained therein. For instance, if the header declares a derived class, the base class header must be included as the derived class declaration needs to know the interface details of its base class. Similarly if a class contains an embedded class member, the interface for that member must be known. Pointers and references to types do not require interfaces, thus a forward declaration suffices. However, if a header includes an inline implementation that requires an interface (such as an accessor that returns a type by value, or that invokes a method of a type), the appropriate header for that type must be included.
All types that can be forward declared in a header must be included in the header's corresponding source file.
The one exception to separating interface from implementations is when creating template functions or classes. Templates must be fully-defined thus all implementation details must be available from the header alone. One way of maintaining separation is to have the header include the source file rather than the other way around. However, the inclusion must come after the interface declaration, and the source must not include the header.
tanga
There is no system header called share.h, but if there were, it would be: #include <share.h>
Create the header file as a .h file in the same way you create a source file, .c and place it in the same directory as the .c files. To incorporate it, use the... #include "my_header_file.h" ... directive. Note that there are double quotes instead of greater/less signs. This tells the compiler to look first in the source directory.
The header, io.h, is part of the standard C library and contains declarations for file handling and I/O functions. The file has no practical purpose in C++; it is only included because it was required prior to C++ standardisation. However, it can be used when writing C-style programs and libraries in C++.
I think its in conio.h or stdio.h
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.
Look for typedef in it, but I don't think you will find any.
list of header files in c and function prototype associated with each file
The header file for random functions ( like rand(), srand() ) is stdlib.h in C and cstdlib in C++.
tanga
For start: they are header files.
Use a text-editor.
There is no system header called share.h, but if there were, it would be: #include <share.h>
The source file must include the header file. Beyond that we can only guess at the problem without seeing the content of the source and header files. Do not post the files here. Such questions are better handled by the many C programming forums available elsewhere on the Internet.
Create the header file as a .h file in the same way you create a source file, .c and place it in the same directory as the .c files. To incorporate it, use the... #include "my_header_file.h" ... directive. Note that there are double quotes instead of greater/less signs. This tells the compiler to look first in the source directory.
A header file , a main part and a body
Any file can be called a header. Whenever someone uses #include , it's the same as copy/pasting that file in that spot. Typically though, they call it a header if it's included at the beginning of your source.