G
Guest
I want to save integer value in array(int key[3]) of struct array (Element[10).
But runtime error occured. (=> Source Code)
How I use array of struct?
I am using dotnet 1.1.
=> Source Code ::
using System;
struct Element
{
public int[] key;
public int link;
Element(int init)
{
init = 0;
key = new int[3];
link = init;
}
};
class Test
{
public static void Main(string[] args)
{
Element[] t = new Element[10];
t[1].key[0] = 1; //error
Console.WriteLine("{0}",t[1].key[0]);
}
}
Thank you.
But runtime error occured. (=> Source Code)
How I use array of struct?
I am using dotnet 1.1.
=> Source Code ::
using System;
struct Element
{
public int[] key;
public int link;
Element(int init)
{
init = 0;
key = new int[3];
link = init;
}
};
class Test
{
public static void Main(string[] args)
{
Element[] t = new Element[10];
t[1].key[0] = 1; //error
Console.WriteLine("{0}",t[1].key[0]);
}
}
Thank you.