Today I read “Pro Objective-C Design Patterns for iOS” by Carlo Chung.
So I read about Adapter Pattern and saw this method declared in protocol:
-(void) command: (SetStrokeColorCommand *) command
didRequestColorComponentsForRed: (CGFloat *) red
green: (CGFloat *) green
blue: (CGFloat *) blue;
You can see it on page 115 from book.
Than this method used
[delegate_ command:self didRequestColorComponentsForRed: &redValue
green: &greenValue
blue: &blueValue];
And then declaration of this method on page 118
-(void) command: (SetStrokeColorCommand *) command
didRequestColorComponentsForRed: (CGFloat *) red
green: (CGFloat *) green
blue: (CGFloat *) blue
{
*red = [redSlider_ value];
*green = [greenSlider_ value];
*blue = [blueSlider_ value];
}
What mean * in declaration (*red, *green, *blue) and what mean & (&redValue…)? I saw & with only &error in code.
*is the pointer declarator or dereference operator.In a declaration, * denotes a pointer variable.
&is the address-of operator.Side note:
You should learn the basics of a language before attempting more advanced books.