john ranella

john ranella

  • 1.5k
  • 177
  • 5.4k

Struct and array

Oct 30 2014 5:44 AM
hi,
i've this code
public class a
{
sa sa1 = new sa(0);
public void test ()


{
uint i, j;




for (i = 0; i <= 1; i += 1) {
for (j = 0; j <= 13; j += 1) {


sa1.va[i].vb[j] = false;
}
}
}
public struct sa
{
public sb[] va;
// other variable
public sa(uint i): this()
{
va = new sb[2];
}


}


public struct sb
{


public bool[] vb;
// other variable


public sb(uint i): this()
{
vb = new bool[14];
}


}

}
When i try to run void test i receive this error: ...Object reference not set to an instance of an object"
where am I doing wrong?

Answers (1)