Ex2.5 feedback: Show how a multidimensional array is stored in-memory
This commit is contained in:
parent
415032e0ef
commit
95ddbf5bde
1 changed files with 11 additions and 1 deletions
|
@ -37,7 +37,6 @@ int main() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
double * nvec = multiply( ivec, Nx, mtx );
|
double * nvec = multiply( ivec, Nx, mtx );
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,6 +48,17 @@ int main() {
|
||||||
}
|
}
|
||||||
std::cout << "]" << std::endl;
|
std::cout << "]" << std::endl;
|
||||||
delete nvec;
|
delete nvec;
|
||||||
|
|
||||||
|
// print the matrix as it is stored in memory
|
||||||
|
std::cout << "In-Memory Matrix = ";
|
||||||
|
std::cout << "[" << std::endl;
|
||||||
|
|
||||||
|
for ( int i = 0; i < Nx*Y_SIZE; i++ ){
|
||||||
|
std::cout << mtx[0][i] << ", ";
|
||||||
|
}
|
||||||
|
std::cout << std::endl;
|
||||||
|
std::cout << "]" << std::endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue