i have a problem. in robot c and i don't know how to resolve it. i want to send a vector to a function in robot c. i get a lot of error. do you now a way to resolve???
sample of program:
int estadoPartida[9];
int npessoas(int estadoCorrente[]) { int n=0; int i; for (i=1;i<=8;i++) { if ( estadoCorrente[i]>0) n++; }
return n; }
task main() { int np; np = npessoas(estadoPartida); }
I'm just learning robotC, but this seems like a regular C question. Your array does not need to be passed between these two functions because of where you declared it. Simply:
int estadoPartida[9];
int npessoas( ) { int n=0; int i; for (i=1;i<=8;i++) { if ( estadoPartida[i]>0) // same array as in main n++; }
Users browsing this forum: No registered users and 4 guests
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum