#include <iostream>
using namespace std;
const int MaxDimensiones = 2;
int main()
{
int
v[][MaxDimensiones] = { 1, 2, 3, 4 };
for(int i = 0; i < MaxDimensiones; ++i) {
for(int j =
0; j < MaxDimensiones; ++j) {
cout
<< v[ i ][ j ] << endl;
}
}
return 0;
}
v[ 0 ][ 0 ] = 11;
cout << v[ 0 ][ 0 ] << endl;
#include <iostream>
using namespace std;
const int MaxDimensiones = 2;
void muestra(int v[][MaxDimensiones])
{
for(int i = 0; i <
MaxDimensiones; ++i) {
for(int j
= 0; j < MaxDimensiones; ++j) {
cout << v[ i ][ j ] <<
endl;
}
}
}
int main()
{
int v[][MaxDimensiones] = { 1, 2, 3, 4 };
muestra( v );
return 0;
}
cout << endl << **v << endl;
cout << v[ 0 ][ 0 ] << endl
<< endl;
cout << endl << *( (*v) + 1)
<< endl;
cout << v[ 0 ][ 1 ] << endl
<< endl;
*( (*v) + 1 ) = 55;
cout << *( (*v) + 1) << endl;
cout << v[ 0 ][ 1 ] << endl
<< endl;
*( (*v + MaxDimensiones) + 1 ) = 57;
cout << *( (*v + MaxDimensiones) + 1) <<
endl;
cout << v[ 1 ][ 1 ] << endl
<< endl;
#include <iostream>
using namespace std;
const int MaxElementos = 6;
void muestra(int v[])
{
for(int i = 0; i < MaxElementos;
++i) {
cout
<< v[ i ] << endl;
}
}
int main()
{
int v[] = { 45, 23, 22, 12, 11, 10 };
muestra( v );
return 0;
}
void muestra(int * v)
{
for(int i = 0; i < MaxElementos;
++i) {
cout
<< v[ i ] << endl;
}
}
int main()
{
int v[] = { 45, 23, 22, 12, 11, 10 };
muestra( &v[ 0 ] );
return 0;
}
*v = 11;
cout << *v << endl;
*(v + 2) = 11;
cout << *(v + 2) << endl;
v[ 2 ] = 11;
cout << v[ 2 ] << endl;
#include <iostream>
using namespace std;
const int MaxElementos = 6;
int main()
{
int v[] = { 45, 23, 22, 12, 11, 10 };
for(int i = 0; i < ( MaxElementos
* 3 ); ++i) {
v[ i ] =
i *7;
}
return 0;
}
void muestra(const int v[])
{
for(int i = 0; i < MaxElementos;
++i) {
cout
<< v[ i ] << endl;
}
}
int main()
{
int v[] = { 45, 23, 22, 12, 11, 10 };
muestra( v );
return 0;
}
v[ i ] *= 2;
prumatriz.cpp: In function ‘void muestra(const int*)’:
prumatriz.cpp:10: error: assignment of read-only location