Click here to Skip to main content
15,891,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
C#
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
using namespace std;

int max(int a, int b);
int lcs(char *X, char *Y, int m, int n)
{
	int L[m + 1][n + 1];
	int i, j;


What I have tried:

I have tried the program in visual studio 2015 and I am getting this error
Posted
Updated 24-Jun-16 2:30am
v2

Are you using, by chance, Visual C++? Have a look at this Enabling VLAs(variable length arrays) in MS Visual C++? - Stack Overflow[^].
 
Share this answer
 
Comments
[no name] 24-Jun-16 7:50am    
Cool one a 5. Good that I did not answered the question :) Bruno
CPallini 24-Jun-16 7:56am    
Thank you.
C/C++ do not allow variable sized array this way.
C++
int L[m + 1][n + 1];

Only fixed size arrays are allowed.
For non fixed size arrays, you must use a pointer and allocate memory manually.

Go back to C/C++ basics
The C Programming Language - Wikipedia, the free encyclopedia[^]
https://hassanolity.files.wordpress.com/2013/11/the_c_programming_language_2.pdf[^]
http://www.ime.usp.br/~pf/Kernighan-Ritchie/C-Programming-Ebook.pdf[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900