A fun 3 minute video that explains the basics features of pointers and memory in C++. Copyright Nick Parlante, 1999. These materials are free and available at http://cslibrary.stanford.edu/ For more information see:
http://www.netcore2k.net/articles/pointers
@jamesllewellyn19 ahh thanks man, that makes complete sense. happy 2012. :)
jony1710 3 weeks ago
@jony1710 try "int *a, *b;" i think with "int* a,b;" you are only assigning a as a pointer and not b...
jamesllewellyn19 3 weeks ago
can anybody think of a logical reason why i cant do "int* a,b;" and have them both be pointers?
jony1710 1 month ago
@zfjquery Except you don't set y to null, just x. And the condition tests whether y is null and only then tries to delete it, which doesn't make any sense.
So, your code as written actually works, but doesn't make any sense and will be “a big problem” when used in any program that has more than 10 lines of code.
gsvick 11 months ago
@gsvick
if you delete any pointer twice you will get error . setting it to null is important after deleting so next time you can check before deleting the same pointer if null then dont delete.
zfjquery 11 months ago
@zfjquery That doesn't work either.
gsvick 11 months ago
at the end dnt do
delete x;
delete y; // this will be a big problem
so always do
delete x;
x = NULL;
if(!y) delete y;
zfjquery 11 months ago
This is great, thanks' a bunch man ;)
Ethaninja 1 year ago
yo des jambas b brash!
destructionman1 1 year ago
uhh, yeah sharing whatever...
stphnkng 1 year ago