CGFloat* colors = CGColorGetComponents(hsbaColor.CGColor);
Does this return a float or an array of floats? The asterisk seems to be short for array creation. It is right?
Sorting.
CGFloat *colors declares a variable containing a pointer to at least one CGFloat. CGColorGetComponents returns a pointer to several CGFloats, one after another - an array of C. You take this pointer and assign it (insert the pointer) into the colors variable.
A variable declaration does not create an array. In fact, and CGColorGetComponents . No matter which created object, CGColor created the array and saved it inside the object; CGColorGetComponents allows CGColorGetComponents to specify a pointer to this repository.
Declaring a CGFloat *colors variable only creates a place β a variable β to hold a pointer to one or more CGFloats. The thing in the variable is a pointer, and the thing in this pointer is an array.
If this is still unclear, see Everything You Need to Know About Pointers in C.
Peter Hosey Apr 27 '09 at 9:55 2009-04-27 09:55
source share