Solved

Header files and Pointers

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
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 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.

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now