i'm learning recursive and try this problem of leet code,
Given a non-negative integer numRows, generate the first numRows of Pascal's triangle.
In Pascal's triangle, each number is the sum of the two numbers directly above it.
i compile my code but there is error, it says runtime error
=================================================================
==29==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60300000003c at pc 0x000000406740 bp 0x7ffe037da8b0 sp 0x7ffe037da8a8
READ of size 4 at 0x60300000003c thread T0
Follow through what happens on the second iteration, i = 0 and j = 1.
i != j, so line 22 is hit.
You attempt to access k[-1][0], which goes out of bounds of your array.
"buffer overflow" means you're attempting to write to data beyond what you're supposed to write to.