You cannot assign an array to an array. Even this simplified program will not work:
char *foo(void) { } int main(int argc, char *argv[]) { char a[1]; a = foo(); return 0; }
As this happens:
$ make fail cc fail.c -o fail fail.c: In function 'main': fail.c:7:4: error: incompatible types when assigning to type 'char[1]' from type 'char *' make: *** [fail] Error 1
Redefine str
as char *str
or define another way to rewrite your program so as not to try to assign an array. (What does the surrounding code look like? The code you inserted does not really make sense ...)
source share