Yes, pointers are one of the harder things about programming. I'll have some links for you:
http://delphi.about.com/od/objectpas...a/pointers.htm
http://www.delphibasics.co.uk/Article.asp?Name=Pointers
Ok, I'll breifly explain them:
All your variables are stored in RAM memory. Pointers are also stored there, but they point to another location in RAM. They don't contain value's like 6 or "abc", but memory adresses.
A quick example:
Code:
//Make a new pointer type that points to integers (not sure if this allready exists)
type
pinteger = ^integer;
var
v, w: integer;
p: pinteger;
begin
v := 100;
w := 50;
p := @v; //the value of p is now the memory location of v
showmessage( IntToStr( p^ ) ); //Output: 100 (^ means: show us what is stored at this memory location)
v := v + 10;
showmessage( IntToStr( p^ ) ); //Output: 110
p := @w; //Let p point to w now
showmessage( IntToStr( p^ ) ); //output 40
p := nil; //NIL means "points to nothing"
showmessage( IntToStr( p^ ) ); //gives an error
end;
Hope that helps.
Bookmarks