I have a C-array of CGPoint
that I want to declare in the header file .h.
CGPoint checkPoint[8];
But when I try to give it a value in .m:
checkPoint[8] = { //<-- Error Here
CGPointMake(0, -10),
CGPointMake(10, 0),
CGPointMake(0, 10),
CGPointMake(-10, 0),
CGPointMake(-10, -10),
CGPointMake(10, -10),
CGPointMake(10, 10),
CGPointMake(-10, 10)
};
It gives me an error pointing at the first opening bracket: Expected expression
Im not very used with C-arrays, how is the correct way of doing this?
EDIT
I have tried with extern
in the header file, but I get this error message: Type name does not allow storage class to be specified.
extern CGPoint checkPoint[8];
It must be done outside any type / interface declaration, otherwiseextern
would not be valid. – dasblinkenlight Nov 8 at 10:50@implementation
block in a .m file, and it may not callCGPointMake
. – dasblinkenlight Nov 8 at 10:57