Consider this code segment:
char message[255];
char newMessage[255];
int i;
for (i = 0 ; i < 255 ; i++)
message[i] = i;
newMessage = message;
When I try to do this I get for the last line an error:
incompatible types when assigning to type ‘char[255]’ from type ‘char *
Why do I get that if the arrays has the same type? How do I fix it?
Thanks in advance
It is not possible to assign arrays. You can use memcpy()
to copy the content of one array to another.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With