Home > Back-end >  Ask "is mainly due to the non const value is assigned to a const variable is legitimate, but th
Ask "is mainly due to the non const value is assigned to a const variable is legitimate, but th

Time:12-13

"C + + Primer Plus" sixth edition Chinese page 278 first to the second line of that "drivel () and dabble () is the difference in behavior, is mainly due to the non const value is assigned to a const variable is legitimate, but the opposite is illegal," (chapter 8 of the fourth quarter)
Context is, dabble (p1) cannot be matched to its prototype, the prototype for: void dabble bits (char *); P1, and p1 is defined as: const char [20]="How 's the weather?" ; ,
Ask, "c + + Primer Plus" whether this is in error,

CodePudding user response:

Const char * p="123";
Char * p=p;
P1 [4]='5';//this is reasonable?
  • Related