26th Sep 2018, 1:28 PM
Oleg Storm
Oleg Storm - avatar
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.
26th Sep 2018, 2:32 PM
Hoàng Nguyễn Văn
Hoàng Nguyễn Văn - avatar
+ 2
Nguyen, thank you very much
26th Sep 2018, 2:43 PM
Oleg Storm
Oleg Storm - avatar
0
couse arrays start at 0
26th Sep 2018, 1:46 PM
Ramphy Aquino Nova
Ramphy Aquino Nova - avatar