I have the following code:
typedef unsigned char some_type[6];
int main() {
some_type some_var1;
some_type some_var2;
some_var1 = some_var2;
return 0;
}
And when i try to compile it, I get the following error message:
incompatible types when assigning to type 'some_type' from type 'unsigned char *'
Why is this? Both variables are exactly the same type? What can I do to make it work? I can’t change the typedef, as it is part of an API I am using.
You can’t assign arrays to each other like that. If these are strings, use strcpy:
If not, use memcpy: