MPLABX conflicting declarations for variable

I am trying to append the length of a string pointer which is integer to another string using sprintf. But every time i get "conflicting declarations for variable “_sprintf” ". What are the possible reasons for this error? I need some serious help guys!

void  esp8266(const char *data)
{
    char *p;
    int msglen = strlen(data);
    sprintf(p, "AT+CIPSEND=0,%d", msglen);
}

The pointer *p is not initialized. You are trying to print a string to a pointer, which is not initialized and has no allocated memory. Declare p as a character array of an arbitrary size instead of pointer.

Edited Code:

void  esp8266(const char *data)
{
    char p[20];                           //<------------ change to array
    int msglen = strlen(data);
    sprintf(p, "AT+CIPSEND=0,%d", msglen);
}

Not sure what triggered the above error. Have you include stdio.h in your code? If not make sure, you have stdio.h included at the top all your header files.

Thanks for replaying. Problem fixed. :heart: