Solved

Header files and Pointers

Posted on 2001-06-15
4
182 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

739 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