I've solved the pointer problem now, unfortunately it wasn't the reason for the nan values, but hopefully will be one step closer.
Thanks for all your help.
Andy
On Wed, Apr 27, 2011 at 9:44 PM, Andrew Hassall a.r.hassall@gmail.com wrote:
as long as you only have one-dimensional arrays, the 2 are exactly the same: a linear memory allocation. "array" is only how you chose to think of it.
btw, "normal" is something very subjective, but i would access array elements as: "mbytes[index]" rather than "*(mbytes+index)"
don't get me wrong, but a good book on C would probably help :-)
Thanks, yeah sorry I know that most of my questions are a bit self explanatory, and simple, my first time programming in c, thought id be ok with knowledge from other languages and examples, but I guess not! :) i think a books a good idea.
the main reason I said normal is most examples of pointers id seen were in that format and so assumed it was standard. I thought so, the reason I asked is that I can't set or read any of the values from the reserved bytes. From either method, in either class. am I missing a step? this is just testing but still not working
x->maxp=40; x->as= getbytes(x->maxp*sizeof(float)); neither *(x->as+i)= 10.4; nor x->as[i] = 10.4;
set the value at index i
this is the same for all the other pointers, I've tried casting the value too.
Andy