operands of = have illegal types

5.7k views Asked by At

I am very new to C (after many years). I am using lcc64 and have the following statement

char *logMessage = strdup(argv[1]);

I have no idea why I get the error

"operands of = have illegal types 'pointer to char' and 'int"

Any suggestions?

1

There are 1 answers

2
Andras On

you need to include <string.h> to declare strdup() as returning char*, else the compiler thinks it returns an int