Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics 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.

What is the function for header files in C++ and how to use it

Status
Not open for further replies.

wansaidatulakma

Newbie level 3
Joined
Jul 27, 2006
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,300
i am a c++ beginner. i want to know what is the function of header file in c++ and how to use it..plzz help me.....
 

Re: Header files in c++

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.

Regards,

m_pourfathi
 

Re: Header files in c++

wansaidatulakma said:
i am a c++ beginner. i want to know what is the function of header file in c++ and how to use it..plzz help me.....

Are you new to programming as well?
OR
Have you programmed in any other language like Java?
 

Re: Header files in c++

Hi,

header files are files or a library for specific purposes...

best regards,
randell_xtian :D:D:D:D
 

Re: Header files in c++


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 .

hope be usefull
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top