[gameprogrammer] Re: A Note on C Programming Style

On 5/6/05, Bob Pendleton <bob@xxxxxxxxxxxxx> wrote:
>=20
> I don't know why it is, but some people get pointers and some do not.
>=20

For the longest time, pointers did not make sense to me. I had the
hardest time in school whenever we covered pointers. When I was out of
school and working, I refused to use C or C++ because I couldn't seem
to get pointers. I started working in Perl quite a bit. For some
reason references in Perl were easier for me to catch on. For those of
you that have worked in perl, you may or may not agree with me... One
thing is certain, there are a few different ways to dereference a
reference variable...

declaring an array:

my @array =3D ();

reference to the array:

my $arRef =3D \@array;

dereferencing values within the array:

$arRef->[0];=20
$$arRef[0];
${$arRef}[0];

I think there may be even a few more. Perl also has a dumping utility
that allows you to deeply deconstruct any data type. When dumping, the
result is perl code, so you can quickly understand how to get at the
value you want.

After working with Perl for a few years, then Java, I've come back to
C/C++ and now I'm in the group of people that 'just get it' when it
comes to pointers.

-Wes


---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: