Cant initialize a 2d array/matrix to 0

Advertisements I am trying to initialize a 2d array (matrix) to 0 but, cant do it: int longestCommonSubsequence(string text1, string text2) { int len1=0; len1=text1.length()+1; int len2=0; len2=text2.length()+1; int dp[len1][len2]={0}; Error: Line 8: Char 16: error: variable-sized object may not be initialized int dp[len1][len2]={0}; ^~~~ 1 error generated. I want initialize the matrix while declaring… Read More Cant initialize a 2d array/matrix to 0

Runtime Error when Trying Bottom Up Approach to Implement Fibonacci function in Swift?

Advertisements I am trying to implement a Fibonacci function in Swift 5. While I was implementing the function on Xcode Playground (I took the code for the function from CSDojo’s youtube video), I was encountered with this error message error: Execution was interrupted, reason: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) Initially, I thought the error must come from… Read More Runtime Error when Trying Bottom Up Approach to Implement Fibonacci function in Swift?