for i in A:
print(' '.join(map(str, i)))
matrix = [["A", "B"], ["C", "D"]]
print('
'.join([' '.join([str(cell) for cell in row]) for row in matrix]))
for row in A:
for val in row:
print '{:4}'.format(val),
print
void printElements(int* arr,int r,int c){
for (int i = 0; i < r; ++i){
for (int j = 0; j < c; ++j){
cout<<( *((arr + i * c) + j))<<" ";
}
cout<<"
";
}
return;
}
// To call this function:
printElements(*array, row, column);
2-D Vectors
vector<vector<int>> vect;
for (int i = 0; i < vect.size(); i++)
{
for (int j = 0; j < vect[i].size(); j++)
{
cout << vect[i][j] << " ";
}
cout << endl;
}
A B
C D