Since it's a value type, declare a variable of this type, it would allocate
the memory:
matrix m;
If you're trying to port application from C/C++, you should redesign it a
little so you won't need pointers.
If data is an array of doubles, declare an array of doubles:
struct matrix
{
public int row_dim;
public int col_dim;
public double[] data;
} ;
To actually create an array, use this:
m.data = new double[m.row_dim * m.col_dim];
In this case, however, you don't need matrix type at all, just declare
managed array:
double[,] mm;
mm = new double[10,10];
Console.WriteLine ("This array has {0} dimentions.", mm.Rank);
for (int d = 0; d < mm.Rank; d++) {
Console.WriteLine ("Dimention {0} has size of {1}.", d,
mm.GetLength(d));
}
Note you have all the information about array size inside the array.
Best regards,
Ilya
This posting is provided "AS IS" with no warranties, and confers no rights.
*** Want to find answers instantly? Here's how... ***
1. Go to
http://groups-beta.google.com/group/...ramework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
"Naveen koul" <(E-Mail Removed)> wrote in message
news

35C91C0-CB5E-4F9E-940A-(E-Mail Removed)...
> Sir ,
>
> I am new to c#, I am unable to allocate memory to this structure. can
> anyone
> please tellme how can we allocate memory to this strucutre.
>
> struct matrix
> {
> public int row_dim;
> public int col_dim;
> unsafe public double **data;
> } ;
>
> Regards
>
> Naveen