My compiler(gcc) is showing the warning
#include<stdio.h>
struct s{
unsigned char *p;
};
int main() {
struct s a = {"??/??/????"}; //warning
printf("%s",a.p);
return 0;
}
warning: pointer targets in initialization differ in signedness
please help me to why is this warning comes.
String literals are not of type
unsigned char*.You probably meant to type
const char*in your struct. If not, you probably do not want to assign a string literal to it without making itconst, because it is illegal to modify the memory in which string literals reside.