c++ - Passing parameters to a functions -


i created test function: void test(double** matrix);

i want pass function variable double matrix[2][2] = {{1,2},{2,3}};. evil compiler writes: cannot convert «double (*)[2]» «double**» argument «1» «void test(double**)».

what need do?

the types of arguments , parameters have agree (or @ least compatible). here, have double[2][2], , want pass double**. types unrelated: array of arrays not array of pointers (which convert pointer pointer).

if want pass double [2][2], you'll have declare parameter double (*matrix)[2], or (better yet), double (&matrix)[2][2].

of course, if you're using c++, you'll want define matrix class, , use it.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -