T
thomas
void doit(const char* p){
char *q = p; //ERROR! <1>
}
char *p = "abc"; <2>
char *q = p; //ERROR! <1>
}
char *p = "abc"; <2>
thomas said:void doit(const char* p){
char *q = p; //ERROR! <1>
}
char *p = "abc"; <2>
thomas said:void doit(const char* p){
char *q = p; //ERROR! <1>
}
char *p = "abc"; <2>
Balog said:The standard specifies it (case 2) as a special conversion that is
allowed. For the sake of compatibility with old C sources. It is
deprecated, and probably will get removed in the next version.
A decent compiler should issue a warning, even if it is not
required to.
void doit(const char* p){
char *q = p; //ERROR! <1>
}
char *p = "abc"; <2>
void doit(const char* p){
char *q = p; //ERROR! <1>
}
char *p = "abc"; <2>
please correct it to
void doit(const char *p){
char *q=strdup(p);
}
char *p=strdup("abc");
These will work in new versions.
compiler version 5.0 is not giving error in old one
you specified.
please correct it to
void doit(const char *p){
char *q=strdup(p);
}
char *p=strdup("abc");
These will work in new versions.
compiler version 5.0 is not giving error in old one
you specified.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.