Re: Accessor method for array of floats
Re: Accessor method for array of floats
- Subject: Re: Accessor method for array of floats
- From: Dylan Adams <email@hidden>
- Date: Mon, 21 Jul 2003 20:13:02 -0500
Johan Kool wrote:
I am very grateful to the help I got so far, but I am still a little
stuck on my problem. I get this error "JKDataModel.m:63: error:
incompatible types in assignment" for the line where I say "time =
inArray;". I've tried every combination with asterisks and ampersands I
could think of, but I must say I don't completely get what the problem is.
What am I doing wrong?
You've declared `time' as an array of pointers to floats. I doubt that's
what you want. You really should do
float *time; //pointer to float
or
float time[0]; //zero length array of floats
They're equivalent definitions. The second is a gcc extension, i believe
Note that this won't directly fix your problem, which you seem to have
worked around in quite a few places. In general, your code makes me
think that you aren't very comfortable with dealing with C pointers and
arrays. I would suggest you either switch to easier to use NSArrays or
get a good book on C. I think that ``Code Complete'' has a fairly good
chapter on pointers, as well as other pitfalls.
There's another problem other problems with your code: you're not using
the return value from realloc. It can return a pointer to a new block of
memory to fufill your request and free the pointer you passed in.
dylan
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.