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?
puts
requires const char*
, you are delivering unsigned char
, not even a pointer.
From here:
#include <stdio.h>
int puts(const char *s);
The puts()
function writes the string pointed to by s
to 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!!