Creating a private 2D float array - Objective C
Creating a private 2D float array - Objective C I am tring to create a private 2D float array and initialize it in constructor. I am getting "Expected Expression" error. I searched for a long while and couldn't find anything. Here is my code: @interface SampleClass : NSObject{ @private float stops[2][2]; } @end @implementation SampleClass - (id) init{ self = [super init]; // Edited stops = { {1.0, 1.0}, {1.0, 2.0} }; // It gives "Expected Expression" at this line return self; } @end I tried different versions like: stops = { {1.0, 1.0}, {1.0, 2.0} }; stops = { 1.0, 1.0, 1.0, 2.0 }; stops = { {1.0, 1.0}, {1.0, 2.0} }; Non of them seems to work. I am new to Objective C so any recommendation is appreciated. Not related to the issue but you must call super in init . Take a look at init. – Willeke Jul 2 at 10:38 ...