Notes
This function is in beta test. Please help improve it in the issues
here.
/in/lab4.c:167:32: runtime error: index -1 out of bounds for type 'char [100]' ================================================================= ==49390==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffe4ca5646f at pc 0x558a762ef347 bp 0x7ffe4ca54cd0 sp 0x7ffe4ca54cc0 READ of size 1 at 0x7ffe4ca5646f thread T0 #0 0x558a762ef346 in main (/out/package/lab4+0x37346) #1 0x7fef6a052b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #2 0x558a762f7d99 in _start (/out/package/lab4+0x3fd99) Address 0x7ffe4ca5646f is located in stack of thread T0 at offset 5695 in frame #0 0x558a762dab4f in main (/out/package/lab4+0x22b4f) This frame has 11 object(s): [32, 192) 'varvalue' [224, 524) 'vars' [576, 1536) 'stack1' [1568, 2528) 'stack2' [2560, 3584) 'helper' [3616, 5664) 'stack3' [5696, 5796) 'com' <== Memory access at offset 5695 underflows this variable [5856, 6112) 'str' [6144, 6400) 'strong' [6432, 6688) 'str1' [6720, 6976) 's
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
Show the results! a * b = 70.910000, b - c + a * f = 13932.010000 ans = -7062633.450000