I have a char* data that I casted in order to access it like this
arr[2][3]
I proceeded that way :
char (*arr)[size] = (char (*)[size])data;
My problem is how can I pass "arr" as an argument to a function ?
void func(??? arr)
{
...
}
void test(char *data, int size)
{
char (*arr)[size] = (char (*)[size])data;
func(arr);
}
I don't know the value of "size" at compile time.
Also, I know that I could just access my value like this : data[2 * size + 3] but I need to avoid multiplications for speed constraints.
void func(char **arr)char (*arr)[size]is not standard C++. Anyway, you cannot castdatainto such type, in the same way you cannot castappleintoorange. It doesn't make sense.arr[x][y]if you do give it knowledge of the array dimensions?