I'm compiling my C code using Microchip's C18 compiler. I'm getting a warning [2054] suspicious pointer conversion in this code:
unsigned char ENC_MAADR1 = 0x65;
unsigned char ENC_ReadRegister(unsigned char address);
// ...
puts(ENC_ReadRegister(ENC_MAADR1)); // <-- warning on this line
What does this warning mean and how can I solve it?
putsrequiresconst char*, you are deliveringunsigned char, not even a pointer.From here:
The
puts()function writes the string pointed to bysto standard output stream stdout and appends a newline character to the output. The string's terminating null character is not written.Use
putc(int c, FILE* stream)instead... See here for a reference.Thank you for the annotations!!