• Source
    1. #include<stdio.h>
    2. #include<vector>
    3. using namespace std;
    4. void fun(vector<int> v[]) // Look parameter
    5. {
    6. int i,j;
    7. printf("\n\n In function \n");
    8. for( i=0; i< 2 ; i++ )
    9. for( j=0; j< v[i].size(); j++ )
    10. printf(" %d <- another way %d\n", v[i][j], v[i].at(j) );
    11.  
    12.  
    13. }
    14. int main()
    15. {
    16. int i=10;
    17.  
    18. vector <int> ve[5]; // this is a 2D vector, row 5, column inf
    19.  
    20. ve[0].push_back(61); // it store at 0,0 index
    21. ve[0].push_back(50); // it store at 0,1 index
    22.  
    23. ve[1].push_back(41); // it store at 1,0 index
    24. ve[1].push_back(40); // it store at 1,1 index
    25. ve[1].push_back(i );
    26.  
    27. for( i=0; i< 2 ; i++ )
    28. for(int j=0; j< ve[i].size(); j++ )
    29. printf(" %d <- another way %d\n", ve[i][j], ve[i].at(j) );
    30.  
    31. fun( ve );
    32. ve[0].clear(); // Now ve[0] is empty
    33.  
    34. return 0;
    35. }