Re: Array controllers in code?
Re: Array controllers in code?
- Subject: Re: Array controllers in code?
- From: Ken Thomases <email@hidden>
- Date: Thu, 22 Jul 2010 13:51:24 -0500
On Jul 22, 2010, at 1:20 PM, Amy Gibbs wrote:
> double *price, *uom, *cost;
You have declared pointers to double, a scalar type. "double" is _not_ an object type.
> price = [Product valueForKey:@"UOMcost"];
> uom = [Product valueForKey:@"purchaseUOM"];
The above is wrong, and the compiler probably complained about it. -valueForKey: is not returning a double nor a pointer to a double. Most likely, in your case, it is returning a pointer to an NSNumber object. You can ask an NSNumber for a double value (which, again, will not be a pointer to a double).
> cost = uom/price;
> although the actual calculation won't work, not sure why, example values are price=8.8, uom=25, getting an error:invalid operands to binary?
That's because you are attempting to divide two pointers. That doesn't make sense.
Regards,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden