#36 not able to use array funktions...

open
nobody
None
5
2013-01-02
2011-02-09
Anonymous
No

After trying the ArrayMax funktion and some compile fails, (even the programm that was in the library did not work) I tried to build one myself.

#include "NXCDefs.h"
int Arraymax(int& src[], int idx, int len) {
int g=0;
for(int i=idx;i<len;i++) {
if(src[idx]>g) {
g=src[idx];
}
}
return g;
}
task main() {
int a[];
int c=1;
a[0]=4;
a[1]=5;
int b=Arraymax(a,0,2);
}

But this can´t be compiled, too.
As I have generally problems with array I wonder how to use them right or if this is an known problem, that they don´t everywhere. (the saple program didn´t work...)

I´m looking forward to answers

Discussion