dle3ab at angelbase.com
Thu Feb 11 23:12:08 CET 2010
On Thu 11 Feb 2010, Rainer Stratmann wrote:
> How can I have access to position 4 of a pointer?
> p : pbyte;
> c : char;
> s : ansistring;
> x : longint;
> s := 'Hello';
> p := @s;
> x := 4; // 4th position
> c := [p+x]^ ??? how to get access to the 'o'
c := (p+x)^; // why would someone use square brackets for that?
Of course, if you are actually working with a string, there is no need
to use pointers.
c := s; // remember strings are 1-indexed
You can also increment...
inc (p, 4);
c := p^;
I might make a second pointer, q, and increment that, so p can stay in
More information about the fpc-pascal