jeudi 25 octobre 2007

Multidimensional Arrays

#include
using std::cout;
using std::cin;
using std::endl;

void affiche(int data[][3]);
int main()
{
int array1[2][3]={{1,2,3},{3,4}};
int array2[2][3]={{1},{2}};
int array3[2][3]={{1,2},{6,7}};

cout<<"la 1 ere matrix est"<<
affiche(array1);
cout<<"la 2 ere matrix est"<<
affiche(array2);
cout<<"la 3 ere matrix est"<<
affiche(array3);
system("pause");
return 0;
}
void affiche(int data[0][3])
{ for(int i=0;i<2;i++) j="0;j<3;j++)"><<" " ; cout<
}
}
the function must know exactly how many elements are in each row so it can skip the proper number of memory locations when accessing the array

Aucun commentaire: