Timeline for Error handling strings and chars
Current License: CC BY-SA 4.0
13 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 8, 2018 at 21:35 | answer | added | chrisl | timeline score: 0 | |
| Jul 8, 2018 at 13:20 | comment | added | wBB | Great article! But I have not been able to solve the problem that is overwriting the contents of the variables, since the use of the pointers in my example seems to be correct according to your article. Thanks. | |
| Jul 8, 2018 at 7:49 | comment | added | Majenko | Read: majenko.co.uk/blog/arrays-pointers-what-c | |
| Jul 8, 2018 at 5:34 | answer | added | Juraj♦ | timeline score: 1 | |
| Jul 8, 2018 at 5:03 | comment | added | wBB | Copy works correctly with these modes of operation, but they are still overwriting the contents of the variables. I can not understand ... Thanks! | |
| Jul 8, 2018 at 4:06 | comment | added | jsotola | found this ... stackoverflow.com/questions/13294067/… | |
| Jul 8, 2018 at 4:04 | comment | added | jsotola | i am not sure about the ss1 and ss2 pointers ..... maybe, because the ss1 and ss2 are created without a size, ss2 points to memory ss1+0 | |
| Jul 8, 2018 at 3:59 | comment | added | jsotola | strings are null terminated .... the char array must have space for that null | |
| Jul 8, 2018 at 3:11 | comment | added | wBB |
I understand that you meant that It have problem in length() and that doing length() + 1 works. if string = 'abc', then string.length () should be 3, isn't it? But I insist: So is this an IDE problem? About the second problem, the pointers, why are they overwriting the contents?
|
|
| Jul 8, 2018 at 2:57 | comment | added | wBB | What kind of change do you mean? There are two problems occurring in the code: 1) the string is removing the last character when copying; 2) The contents of the second variable are overwriting the contents of the first variable. | |
| Jul 8, 2018 at 2:53 | comment | added | jsotola |
see what happens if you make a change in this line ... txt.toCharArray(ss1, txt.length()); .... think about it
|
|
| Jul 8, 2018 at 2:08 | review | First posts | |||
| Jul 8, 2018 at 9:52 | |||||
| Jul 8, 2018 at 2:06 | history | asked | wBB | CC BY-SA 4.0 |