Re: Array-wise operations

2010-10-12 Thread bearophile
Bob Cowdery: > How confusing to support two ways of doing something which require the > indices in a different order. Yes, it's a mess. I have proposed to accept that C syntax only when the -d compiler switch is used (it also enables C-style function literals and maybe C function pointers too).

Re: Array-wise operations

2010-10-12 Thread Bob Cowdery
On 12/10/2010 21:43, Simen kjaeraas wrote: > Bob Cowdery wrote: > >> x_average[ptr] = x_points; // tells me array length don't match. >> >> When I print x_average[ptr] or x_average[][ptr] or x_average[ptr][] they >> all tell me the length is 10. What do I have to do to get to the row >> which is

Re: Array-wise operations

2010-10-12 Thread Bob Cowdery
On 12/10/2010 21:25, Bob Cowdery wrote: > On 12/10/2010 21:11, Simen kjaeraas wrote: >> Bob Cowdery wrote: >> >>> On 12/10/2010 20:29, Simen kjaeraas wrote: Bob Cowdery wrote: > x_points[] > =(x_average[0]+x_average[1]+x_average[2]+x_average[3]+x_average[4]+x_average[5]+

Re: Array-wise operations

2010-10-12 Thread Simen kjaeraas
Bob Cowdery wrote: x_average[ptr] = x_points; // tells me array length don't match. When I print x_average[ptr] or x_average[][ptr] or x_average[ptr][] they all tell me the length is 10. What do I have to do to get to the row which is 600? Oh, yes. Sorry, I didn't see that at first. D (for s

Re: Array-wise operations

2010-10-12 Thread Bob Cowdery
On 12/10/2010 21:11, Simen kjaeraas wrote: > Bob Cowdery wrote: > >> On 12/10/2010 20:29, Simen kjaeraas wrote: >>> Bob Cowdery wrote: >>> x_points[] =(x_average[0]+x_average[1]+x_average[2]+x_average[3]+x_average[4]+x_average[5]+ x_average[6]+x_average[7]+x_average[8]+

Re: Array-wise operations

2010-10-12 Thread Simen kjaeraas
Bob Cowdery wrote: On 12/10/2010 20:29, Simen kjaeraas wrote: Bob Cowdery wrote: x_points[] =(x_average[0]+x_average[1]+x_average[2]+x_average[3]+x_average[4]+x_average[5]+ x_average[6]+x_average[7]+x_average[8]+x_average[9])/10; The average gives me a compile error of incompatible types

Re: Array-wise operations

2010-10-12 Thread Bob Cowdery
On 12/10/2010 20:29, Simen kjaeraas wrote: > Bob Cowdery wrote: > >> x_points[] >> =(x_average[0]+x_average[1]+x_average[2]+x_average[3]+x_average[4]+x_average[5]+ >> >> x_average[6]+x_average[7]+x_average[8]+x_average[9])/10; >> >> The average gives me a compile error of incompatible types. > >

Re: Array-wise operations

2010-10-12 Thread Simen kjaeraas
Bob Cowdery wrote: x_points[] =(x_average[0]+x_average[1]+x_average[2]+x_average[3]+x_average[4]+x_average[5]+ x_average[6]+x_average[7]+x_average[8]+x_average[9])/10; The average gives me a compile error of incompatible types. You need to append [] to x_average[index]. -- Simen

Array-wise operations

2010-10-12 Thread Bob Cowdery
I'm trying to implement some array-wise operations. // I have an array of float values that need to be averaged over a 10 cycle period. float x_points[600]; float x_average[600][10]; int ptr = 0; // I accumulate one cycle in x_points and add that into a circular array of the last 10 c