Error in assigning an array to the other in C
c, pointers
Solution
One way to fix this is by declaring `newMessage` as a pointer: `char* newMessage`.
Another is by using `memcpy()` -- or `strncpy()` if `message` is a string -- to copy the contents of `message` into `newMessage`.
Which method is preferable depends on what you then do with `newMessage`.
Problem
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