Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.
Header Files are like libraries having functions and other primary definitions in your program. For instance you are creating a program which gives you the output in the command prompt.
you have to use the such syntax:
cout << "Your output"
cout is defined in the header file iostream.h which can be load by using #include <iostream.h>. In other words, using such syntax, is like adding all the lines in iostream file to your program.
Syntaxes followed after # are called preprocessing syntaxes. They are executed before the execution of your main program.
you also can visit www.cplusplus.com
or you can use the book "How to program C++" authored by deitel and deitel.
Header files are libraries which include prototypes of all functions used in C language
prototype is a line that you write at the beginning of any C program , it is like the
function deceleration except you add semi colon (; ) after it .
for example :
int line (void); // this is a prototype for a function named line .
the previous line must be written before the main function , or you will have an error message tells you : function line must have a prototype .
when do i have to write the prototype ?
a prototype in the head of a program is to tell the compiler that there is a function
in the code to be invoked . so it would be considered .
does this mean that any function you use have a prototype ? that is correct .
even functions like : printf , cout , scanf , getche, ...etc have prototypes .
these prototypes are in the header files so if you noticed you don't write them
again. so you have to include the header file you need in the program to be
compiled . i'll give you an example : printf function's prototype is in the header file
(stdio.h) so you have to include it in the program if you want to use printf function
cout prototypes is in (iostream.h) etc .