0
Why temp[0] is 'H' ?
3 odpowiedzi
+ 2
temp is assigned the value of ch, which decays to a pointer to the array first element.
if (ch[sz]==' '){
ch[sz] = ch[sz +1];
this changed the array first value - also the value temp points to - from ' ' to H.
Might as well point out that you just allocated a dynamic value but did not call delete and removed the only reference to the dynamic value, which is not good practice.
+ 2
Nguyen, thank you very much
0
couse arrays start at 0