1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Array as instance variable

Discussion in 'iPhone/iPad Programming' started by RutgerB, Apr 1, 2009.

  1. macrumors newbie


    I have a class called GameLogic and I want it to have an instance variable that is a 2D array of integers.

    So I use this code:

    In the .h file:
    @interface GameLogic : UIViewController {
        int board[4];
    @property int board[4];
    And then in the .m file:
    synthesize board[4][4];
    This gives a lot of errors..

    So I want to know how to add a 2D array as an instance variable to a class.

  2. Guest


    synthesize should have a '@' in front of it and you can only synthesize something as it's been declared. Also does the properties/synthesize mechanism work for c array?

Share This Page