Answer the question
In order to leave comments, you need to log in
Why does the incompatible types when assigning to type error occur?
error:
error: incompatible types when assigning to type 'struct Item[100]' from type 'struct Item *'
table = fizz(table);
The code:
#define SIZE 100
struct Item{
int key;
int val;
};
struct Item * fizz(struct Item *table){
return table;
}
int main(){
struct Item table[SIZE];
table = fizz(table);
}
Answer the question
In order to leave comments, you need to log in
table = fizz(table);
Because you can't assign arrays. Such a standard. Think of an array as a constant pointer. It can be copied, but not modified.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question