Notes
This function is in beta test. Please help improve it in the issues
here.
================================================================= ==63657==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffe1f783d21 at pc 0x0000004a8e29 bp 0x7ffe1f777730 sp 0x7ffe1f776ee0 WRITE of size 2 at 0x7ffe1f783d21 thread T0 #0 0x4a8e28 (/out/package/ex6+0x4a8e28) #1 0x4a9da8 (/out/package/ex6+0x4a9da8) #2 0x4a9e8e (/out/package/ex6+0x4a9e8e) #3 0x51526d (/out/package/ex6+0x51526d) #4 0x5155c8 (/out/package/ex6+0x5155c8) #5 0x7f6f3e259b96 (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #6 0x41c959 (/out/package/ex6+0x41c959) Address 0x7ffe1f783d21 is located in stack of thread T0 at offset 50337 in frame #0 0x514d2f (/out/package/ex6+0x514d2f) This frame has 5 object(s): [32, 50032) 'sen' (line 8) [50288, 50292) 'op' (line 17) [50304, 50305) 'c' (line 22) [50320, 50321) 'd' (line 28) [50336, 50337) 'e' (line 45) <== Memory access at offset 50337 overflows this variable HINT: this may be a false positive if your program uses some
Hints
Your answer may be identical to the JOJ answer in the first several lines.
However, the main problem you meet now is Runtime Error. And the exit code of your program is 1, which should be 0.
Please double check your code to solve this problem and try again.
Your Answer
JOJ Answer
Input a string: * Choose 1 to replace a character or 2 to delete a character: Delete character: New string: b b b bbbbb bb bb bb b b b b b b b bb bbb b b b bbb bbb b