Are pointers necessary in C++?
Are pointers useful in C++?
(as opposed to references only)
Are pointers necessary in C++?
Are pointers useful in C++?
(as opposed to references only)
I think so, but shouldn't this be in the C++ forum?
>> Are pointers necessary in C++?
in the most simple cases, no. but for any practicle program pointers are necessary ( you cant even have an array with out a pointer)
>> Are pointers useful in C++?
yes, extremely. usefull for so many reasons i cant even begin to list them.
Function pointer, void pointer, if the location being pointed to needs to be changedOriginally posted by ygfperson
Are pointers necessary in C++?
Are pointers useful in C++?
(as opposed to references only)
>Are pointers necessary in C++?
Yes. References remove most needs for pointers, but in just about any nontrivial program you'll find yourself using them liberally.
>Are pointers useful in C++?
Same question, different words. See above.
>(as opposed to references only)
What if you want to change where a reference refers? Or use a "null" reference?
>Function pointer
You can have references to functions, they just look funny because nobody's used to them.
p.s. What the alphabet would look like without q and r.
I always thought pointers were a way to manage memory, which
would make them useful.
No. Wait. Don't hang up!
This is America calling!
Absolutely, especially if your gonna do low-level type stuff.
I suppose you could program without them, if you just wanted to print something on screen.Originally posted by ygfperson
Are pointers necessary in C++?
Are pointers useful in C++?
(as opposed to references only)
No wait, you need pointers for that.
Code:#include <iostream> using namespace std; int main() { cout << "Hello, pointer world" << endl; // The stuff in the speech marks is addressed by a pointer. return 0; }