I have to add new features to old code. The old code have a problem, there are lot of functions which gets arrays as argument, something like this f(int x[][MAX_LENGTH])
. So I wan't to ask is it ok (standard) to pass int *[MAX_LENGTH]
instead? In other words is the code bellow standart?
# include <iostream>
using namespace std;
void f(int x[][3])
{
for(int i = 0; i < 2; ++i)
{
for(int j = 0; j < 3; ++j)
cout << x[i][j] << " ";
cout << endl;
}
}
int main()
{
typedef int v3 [3];
v3 *x;
x = new v3 [2];
for(int i = 0; i < 2; ++i)
for(int j = 0; j < 3; ++j)
x[i][j] = i * 3 + j;
f(x);
delete [] x;
return 0;
}
edit please point the paragraph of standard document if the answer of the question is "YES".