How do you draw a diagram of all the memory allocated by the code.
char ca[3] [5]
C++ Help!!?
The the amount of memory a char takes up and multiply it by 15.
Reply:That depends on how you want to "draw" it. If you are satisfied with simply printing the data, you could do the following:
std::cout%26lt;%26lt;"#\t0\t1\t2\t3\t4";
std::cout%26lt;%26lt;std::endl;
for ( int rows=0; rows %26lt; 3; rows ++ )
{
std::cout%26lt;%26lt;rows;
for ( int cols = 0; cols %26lt; 5; cols ++ )
{
std::cout%26lt;%26lt;'\t'%26lt;%26lt;ca[rows][cols];
}
std::cout%26lt;%26lt;std::endl;
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment