Notes
This function is in beta test. Please help improve it in the issues
here.
================================================================= ==26419==ERROR: AddressSanitizer: stack-buffer-underflow on address 0x7ffd1e4a0b28 at pc 0x55f7bfb8bbd4 bp 0x7ffd1e4a0ab0 sp 0x7ffd1e4a0aa0 READ of size 4 at 0x7ffd1e4a0b28 thread T0 #0 0x55f7bfb8bbd3 in intMatrix::getElement(int, int) (/out/package/ex3+0x16bd3) #1 0x55f7bfb86b6f in main (/out/package/ex3+0x11b6f) #2 0x7fa7edc31b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #3 0x55f7bfb838b9 in _start (/out/package/ex3+0xe8b9) Address 0x7ffd1e4a0b28 is located in stack of thread T0 at offset 8 in frame #0 0x55f7bfb846f1 in main (/out/package/ex3+0xf6f1) This frame has 32 object(s): [32, 33) '<unknown>' [96, 97) '<unknown>' [160, 161) '<unknown>' [224, 225) '<unknown>' [288, 289) '<unknown>' [352, 353) '<unknown>' [416, 420) 'testcase' [480, 484) '<unknown>' [544, 548) '<unknown>' [608, 612) '<unknown>' [672, 676) '<unknown>' [736, 752) 'a' [800, 816)
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
Testing getElement 2: 4 pts Matrix Information: rows: 4 cols: 5 Matrix[1][5] = 32679 Matrix[1][1] = 1 Matrix[2][3] = -276666592
JOJ Answer
Testing getElement 2: 4 pts Matrix Information: rows: 4 cols: 5 Matrix[1][5] = 1 Matrix[1][1] = 1 Matrix[2][3] = 1 Matrix[4][5] = 1