fork download
  1. #include <vector>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5. typedef double Slot;
  6. typedef vector<Slot> Row;
  7. typedef vector<Row> Table;
  8. typedef Row::size_type RSize;
  9. typedef Table::size_type TSize;
  10.  
  11. void foo(Row *tb, TSize m, RSize n)
  12. {
  13. for (TSize i = 0; i < m; i++)
  14. {
  15. for(RSize j = 0; j < n; j++)
  16. {
  17. cout << tb[i][j] << " ";
  18. }
  19. cout << endl;
  20. }
  21. }
  22.  
  23. int main()
  24. {
  25. Table tb;
  26. for (int i = 0; i < 10; i++)
  27. {
  28. tb.push_back(Row(5, i));
  29. }
  30. foo(&tb[0], tb.size(), tb[0].size());
  31. return 0;
  32. }
  33.  
  34.  
Success #stdin #stdout 0.02s 2860KB
stdin
Standard input is empty
stdout
0 0 0 0 0 
1 1 1 1 1 
2 2 2 2 2 
3 3 3 3 3 
4 4 4 4 4 
5 5 5 5 5 
6 6 6 6 6 
7 7 7 7 7 
8 8 8 8 8 
9 9 9 9 9