If I have a function, say, as follows:
int fun(int n,int a[n][n]){......}
Where n is some value I get from the user via standard input runtime. Am I allowed to use the n
in []
for defining a[n][n]
?
This seems to work in C but not in C++. What is an alternative if I want the exact same functionality in C++?(i.e. take an input as parameter, and the 2D array size itself should be dependent on this parameter)