On 07/27/2014 01:05 PM, Alexandros Drymonitis wrote:
I solved it by declaring the array in the object structure like this: float x_iem_coeff[5][2];
and in the new function I create another, one dimensional array, and run a nested for loop and set the local array's elements to x_iem_coeff[5][2] one by one. This seemed to work, no errors during compilation. The object crashes Pd when the DSP is turned on, but I guess (and think) it's something else that causes that. The array declaration and initialization shouldn't have anything to do with the DSP state, right?
On Sun, Jul 27, 2014 at 7:41 PM, Alexandros Drymonitis <adrcki@gmail.com mailto:adrcki@gmail.com> wrote:
I'm building an external where I want to create a two dimensional array. I'm following this <http://www.tutorialspoint.com/cprogramming/c_multi_dimensional_arrays.htm> example which works well with the attached test code, but creates an error when I try to compile my external. The external's code where the array is being declared and initialized is this: float x_iem_coeff[5][2] = { {0.045535, 1.0277}, {0.161621, 1.2569}, {0.393858, 1.96655}, {1.13986, 4.51667}, {6.36341, 22.7468} }; which is in the object structure. The error I get is: overDrive~.c:35:25: error: expected ';' at end of declaration list float x_iem_coeff[5][2] = { ^ ; I've tried to declare the array in the object structure and initialize it in the new function, but I still got the same error. Any tips?
In C, you can't initialize inside a struct. But you should be able to initialize outside of it. What's the error you get when you try that?
-Jonathan
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list