How do I fix errors relating to 'illegal conversion between pointer types' or 'illegal conversion of integer to pointer'?
This message will be produced if you convert an integer (either literal or variable) to a pointer type, for example:
Example 1:
Assigning an integer constant to a pointer:
will emit this warning:
Warning [357] illegal conversion of integer to pointer
Example 2:
Assigning a char to an integer pointer:
will emit this warning:
Warning [359] illegal conversion between pointer types pointer to unsigned char -> pointer to int
Warning [359] will go away with typecasting:
but the problem is still there.
While casts mask the problems in code and also suppress the warning, they can be potentially dangerous. Use caution while using casts.
For more on this see the FAQ "When should I cast an expression?"