fork download
  1. #include <iostream>
  2.  
  3. void doSomething(int** value, int length, int width)
  4. {
  5. for (int i = 0; i < length; ++i)
  6. for (int j= 0; j < width; ++j)
  7. std::cout << value[i][j] << std::endl;
  8. }
  9.  
  10. int main()
  11. {
  12. // array of arrays of int
  13. int arr[2][2] = { { 1,2 },{ 3,4 } };
  14.  
  15. // convert to array of pointers to int
  16. int *vals[2] = { arr[0], arr[1] };
  17.  
  18. doSomething(vals, 2, 2);
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
1
2
3
4