char*. std::string, . .
, , , , .
while(input != '\0'){
, :
while(*input != '\0') {
input \0, .. , \0 char. , , 'x' 'a', .
*input, char, .
a += input[i];
input++;
i++;
. input, [i] . , input , input[3] 7- , , . undefined, . undefined " 10".
:
a += *input;
input++;
i++;
(In fact, now that it is ino longer in use, you can delete it altogether.)
And let me repeat again: Do not use char*. Use std::string.
source
share