I've got a library function I need to call and I'm having trouble with c++ basics for some reason.
The declaration of the function is:
void doSomething(int** values, int length, int width);
It's taking an array of integer arrays. This is fine, I'm having trouble sending getting the data into it.
My data is just 2 integers, say 4 & 5.
In c# I think the syntax would be somethings like: [ [4,5] ]
An array containing an array which contains the two values. How on earth do you declare this basic structure in C++?
I've tried:
int vals[1][2] = { {4,5} };
doSomething(vals, 1,2);
But the compiler comes back with:
error: no matching function for call to ‘myclass::doSomething(int [1][2], int, int)’
doSomething(vals, 1, 2);
^
src/mysclass.cpp:74:6: note: candidate: void myclass::doSomething(int**, int, int)
This must be simple. There must be a simple way to declare this data to call the function with these values. I'd prefer stack based, if possible.