no no, i sugest i didnt write it correctly. but what i want to do:
i have some global fields, which has to be changed at some point, and thats why i wanted to use that function forexample f(), which is gonna make some operations with field and returns new field. than there is another function f2(), which take as an argument field - for first time field x, and second time changed field
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
word x[5] = {0,1,2,3,4};
word y[5] = {2,4,6,8,10};
word f(word a[5]) {
word b[5];
for(int i= 0; i<5; i++) b[i] = -a[i];
return // how do i return whole field?
}
word f2(word u, word s[5]) {
//some operations ....
}
int main() {
word f2(0x26ff, b);
word f2(0x26ff, f(b)); // this wasnt working for me
return 0;
}
|
the operations i used in f() i used just for ilustration. now i know, that first example i used above, where i was returning b[5] was wrong, because i was returning just one element.
i was looking at the link you gaved me, but i am not more clever from that how to return field.
i supose the best way is throug reference, but i have no idea how. thank you for you replies.