0

I have a matrix data type and a function with a formal parameter of matrix type. Since the function will not modify its parameter I use a const qualifier:

typedef int Matrix[2][2];

static void Foo(const Matrix A)
{
    ...
}

When I call this function it seems like I need to cast the actual parameter:

Matrix A;
...
Foo((const int (*)[2]) A);

Without the cast the compiler I use (GCC) will issue a warning:

warning: pointers to arrays with different qualifiers are incompatible in ISO C [-Wpedantic]

Is there a different way to approach the problem so that the cast is not necessary?

7

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.