This is kinda tricky.
First, take a look in Wikipedia:
http://en.wikipedia.org/wiki/Dynamic_array
The bad way, is to use "resize" method every time:
double[] a = new double[0];
for (int i=0;i<length;i++) {
a.resize(i);
a[i]=num;
}
(Never code like this, I just showed you what happens)
Every time you use the "resize" method, the array is reallocated or increasing
space(if there any).
Lucky, there are such GArray in GLib:
http://developer.gnome.org/glib/2.31/glib-Arrays.html#GArray
Good luck!
Tal
> From: [email protected]
> To: [email protected]
> Date: Sun, 27 Jan 2013 20:56:49 +0700
> Subject: [Vala] Vala dynamic array with double []
>
> What alternative to define array like this:
> in PHP or C# we can do
> $arrOptions = array();
> $arrOptions[][] = 1;
>
> any suggestion or what library that have class or other?
> thanks
>
> _______________________________________________
> vala-list mailing list
> [email protected]
> https://mail.gnome.org/mailman/listinfo/vala-list
_______________________________________________
vala-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/vala-list