Notes
This function is in beta test. Please help improve it in the issues
here.
================================================================= ==15993==ERROR: AddressSanitizer: heap-use-after-free on address 0x6030000000a0 at pc 0x000000517525 bp 0x7ffda6381740 sp 0x7ffda6381738 READ of size 4 at 0x6030000000a0 thread T0 #0 0x517524 (/out/package/dictionary+0x517524) #1 0x514dd7 (/out/package/dictionary+0x514dd7) #2 0x515149 (/out/package/dictionary+0x515149) #3 0x7fa8f0487b96 (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #4 0x41c959 (/out/package/dictionary+0x41c959) 0x6030000000a0 is located 0 bytes inside of 24-byte region [0x6030000000a0,0x6030000000b8) freed by thread T0 here: #0 0x4dc640 (/out/package/dictionary+0x4dc640) #1 0x515126 (/out/package/dictionary+0x515126) #2 0x7fa8f0487b96 (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) previously allocated by thread T0 here: #0 0x4dc810 (/out/package/dictionary+0x4dc810) #1 0x515553 (/out/package/dictionary+0x515553) #2 0x5150dc (/out/package/dictionary+0x5150dc) #3 0x7fa8f0487b96
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
0 ***Print Dictionary*** Original: {}. Reversed: {}. ****Print Finished**** 1 ***Print Dictionary*** Original: {24:19, }. Reversed: {24:19, }. ****Print Finished**** 2 ***Print Dictionary*** Original: {24:19, }. Reversed: {24:19, }. ****Print Finished**** 3 ***Print Dictionary*** Original: {24:19, }. Reversed: {24:19, }. ****Print Finished**** 4 The value is 19. ***Print Dictionary*** Original: {24:19, }. Reversed: {24:19, }. ****Print Finished**** 5 ***Print Dictionary*** Original: {24:19, }. Reversed: {24:19, }. ****Print Finished**** 6 ***Print Dictionary*** Original: {24:19, }. Reversed: {24:19, }. ****Print Finished**** 7 ***Print Dictionary*** Original: {24:19, }. Reversed: {24:19, }. ****Print Finished**** 8 ***Print Dictionary*** Original: {24:19, }. Reversed: {24:19, }. ****Print Finished**** 9 ***Print Dictionary*** Original: {20:26, 24:19, }. Reversed: {24:19, 20:26, }. ****Print Finished**** 10 ***Print Dictionary*** Original: {20:26, 24:19, 26:5, }. Reversed: {26:5, 24:19, 20:26, }. ****Print Fin
JOJ Answer
0 ***Print Dictionary*** Original: {}. Reversed: {}. ****Print Finished**** 1 ***Print Dictionary*** Original: {24:19, }. Reversed: {24:19, }. ****Print Finished**** 2 ***Print Dictionary*** Original: {24:19, }. Reversed: {24:19, }. ****Print Finished**** 3 ***Print Dictionary*** Original: {24:19, }. Reversed: {24:19, }. ****Print Finished**** 4 The value is 19. ***Print Dictionary*** Original: {24:19, }. Reversed: {24:19, }. ****Print Finished**** 5 ***Print Dictionary*** Original: {24:19, }. Reversed: {24:19, }. ****Print Finished**** 6 ***Print Dictionary*** Original: {24:19, }. Reversed: {24:19, }. ****Print Finished**** 7 ***Print Dictionary*** Original: {24:19, }. Reversed: {24:19, }. ****Print Finished**** 8 ***Print Dictionary*** Original: {24:19, }. Reversed: {24:19, }. ****Print Finished**** 9 ***Print Dictionary*** Original: {20:26, 24:19, }. Reversed: {24:19, 20:26, }. ****Print Finished**** 10 ***Print Dictionary*** Original: {20:26, 24:19, 26:5, }. Reversed: {26:5, 24:19, 20:26, }. ****Print Fin