I\'m trying to print the list of a singly linked list that I referred to in link text. It works, but I do get the compiler warnings:
Initializat
In following function, would get the warning that you encountered with.
void test(const char *str) {
char *s = str;
}
There are 3 choices:
Remove the const modifier of param:
void test(char *str) {
char *s = str;
}
Declare the target variable also as const:
void test(const char *str) {
const char *s = str;
}
Use a type convert:
void test(const char *str) {
char *s = (char *)str;
}