Solved

Header files and Pointers

Posted on 2001-06-15
4
184 Views
Last Modified: 2010-04-02
I am a student. This is not an assignment. Do you always have to have a header file in C++? How does the program work if you do not need a header file? I also was hoping someone could send me a good link that explains pointers and maybe linked lists.
0
Comment
Question by:awjackin35
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 6195019
See:

http://www.experts-exchange.com/jsp/qShow.jsp?ta=cplusprog&qid=20135953

So it seems you and sajid are taking the same class?
0
 

Author Comment

by:awjackin35
ID: 6195061
I already read the answers and sajid question. That is why I asked the question. What about iostream.h, Don't you have to have that header file? I also need a good pointers and LL Tutorial.
0
 
LVL 5

Accepted Solution

by:
garboua earned 75 total points
ID: 6195299
here is a quick and simple tutorial about LL
http://personal.adesso.com/~dkovacs/linklist.html
WElL, you need a header file to tell source code that some kind of a function exists some where and tell the compiler not to panic
you can always tell the compiler about other functions in another source file by using the "extern."  Most people don't do this because it becomes old and just too much work.  you have to remember all funcs and put them in all source code and etc etc etc.
you only need to include iostream if you are using one of its funciton, if not then you don't have to.
hope that helped.
0
 
LVL 10

Expert Comment

by:makerp
ID: 6195633
you need to include header files for the functions you want to use. for example to use cout,cin etc you need to include <iostream.h>, if you had no call for these then you need not include it. you can write your own headers and put constants, function/class declarations etc in them, although you should not include function/class definitions in a header. these are best in a source file and then compiled/linked in with the program.

for example

++++++++myheader.h

#define MY_CONSTANT   1000

class myclass
{
 public:
   void mymember();
}

++++++++mysource.cpp

#include "myheader.h"

void myclass::mymember()
{
 /* some code */
}
0

Featured Post

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question