C++, error: incompatible types in assignment

Can anybody help me, what's wrong with my code ?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  ...
struct Duomenys
{
    ...
    int Balart[10]
    ...
};

...
void Suma(int suma[], int B[], int n, int k); 
int main(){
...
A[i].Balart = Suma(A[i].Balart, A[i].art, n, k); 
...
}
void Suma(int suma[], int B[], int n, int k) 
...


error: incompatible types in assignment of 'void' to 'int[10]'

Last edited on
I assume you have the following line that you did not show:
 
Duomenys A;

Otherwise A would be undefined.

line 5: You're missing a ;

Line 13: Your subscripting is incorrect. Presumably, it is Balart that is subscripted, not A. However, since you didn't show the definition of A, that is only a guess. Where is A.art defined? Did you mean Balart?

 
A.Balart[i] = Suma(A.Balart, A.Balart, n, k); 





Oh, I forgot to mention it,
A.art is defined in structure Duomenys

and I forgot to show this line:
Duomenys A[Ck];



Suma has return type void, which means it doesn't return anything.
Topic archived. No new replies allowed.