Question on pointers?

This is a discussion on Question on pointers? within the C++ Programming forums, part of the General Programming Boards category; Hello everyone, I am in my first semester on C++ and I am wondering if someone could clarify my understanding ...

yes, but they can be used like any other variable, global or not. Just make sure you initialize the pointer to something before you attempt to use it. Many people, including old-timers, make that mistake and wonder why their program crashes.

"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell

I am using visual c++ on this code. Is it possible to use <iostream> in visual c++ because I tried it and it did'nt work?
In which I might add bloodshed is much better. This visual c++ just came with my book Titled "C++ Programming Today".

"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell

"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell

When you have using std::cout; or (ugh) using namespace std;, you can drop the std:: from couts. That's the whole point. If you're just going to leave the std:: in then you don't need anything special.

"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell

>> May I ask the importance of using <iostream> rather than <iostream.h>

Because <iostream.h> is old and non-standard. That means that new compilers that follow standard C++ don't have to make it work. In fact, some already don't allow code with <iostream.h> to compile (including Visual C++ 7.1 and 8.0).

The <iostream> version is the newer version that was part of the standard in 1998. All your new code should use it even if your compiler still works with the older version so that if and when you move to a newer compiler, you don't have to change your code.