C (243/414)

From:David McMinn
Date:12 Jun 2000 at 14:22:38
Subject:pointer arithmatic

hi all,

whats the "correct" way to add a value to a pointer?

I currently have a couple of ULONG *'s that I'm copying a rectangular area
between. Obviously when I'm done with one row of data I want to increase the
pointers by the modulus of the memory area.

so I simply added (src->width - rectangle->width) onto my pointer to find out
that everything was corrupt although I figured out that I needed to divide the
modulus by 4.

Now, I know that some things work on the size of the pointer (++ increases by 4
etc) but I thought adding a value onto it would simply add that value on? Or
does it always take that value to be the number of ULONGs to add on in this
case?



|) /\ \/ ][ |) |\/| c |\/| ][ |\| |\| | dave@satanicdreams.com
http://members.xoom.com/David_McMinn | ICQ=16827694
Fear Kevin.....http://www.kevinwarwick.org.uk

------------------------------------------------------------------------
IT Professionals: Match your unique skills with the best IT projects at
http://click.egroups.com/1/3381/1/_/451227/_/960816192/
------------------------------------------------------------------------