Hi I am new to C++ and I am having trouble with pointers.
Can someone try and explain it to me so I can understand it.
Thanks for your time!
Hi I am new to C++ and I am having trouble with pointers.
Can someone try and explain it to me so I can understand it.
Thanks for your time!
Here's a really good tutorial: http://pweb.netcom.com/~tjensen/ptr/pointers.htm
-Govtcheez
[email protected]
what about pointers dont you understand?
they are just memory addresses which store other memory addresses rather than values. You can get the value pointed to by dereferencing the pointer by preceeding it with an asterix *
Code:char array[10]={0}; char* iter=&array; // declare a pointer called iter and point it at the array called array *iter='H';// stores 'H' in array[0] iter++;// moves pointer to point at array[1] *iter='e'; iter++; *iter='l'; iter++; *iter='p'; printf("%s",array);// should print Help
Last edited by Stoned_Coder; 08-27-2001 at 09:36 AM.
Free the weed!! Class B to class C is not good enough!!
And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi