1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
const int MAX=10;
int main(){
char temp='a';
int i,j;
int *pointer[MAX];
int a1[MAX]={0,10,20,30,40,50,60,70,80,90};
int a2[MAX]={100,110,120,130,140,150,160,170,180,190};
int a3[MAX]={200,210,220,230,240,250,260,270,280,290};
int a4[MAX]={300,310,320,330,340,350,360,370,380,390};
int a5[MAX]={400,410,420,430,440,450,460,470,480,490};
int a6[MAX]={500,510,520,530,540,550,560,570,580,590};
int a7[MAX]={600,610,620,630,640,650,660,670,680,690};
int a8[MAX]={700,710,720,730,740,750,760,770,780,790};
int a9[MAX]={800,810,820,830,840,850,860,870,880,890};
int a10[MAX]={900,910,920,930,940,950,960,970,980,990};
for(i=0;i<MAX;i++)//is there a way to initilize arrays in this loop?
*(pointer+i)=new int[MAX];
pointer[0]=a1;
pointer[1]=a2;
pointer[2]=a3;
pointer[3]=a4;
pointer[4]=a5;
pointer[5]=a6;
pointer[6]=a7;
pointer[7]=a8;
pointer[8]=a9;
pointer[9]=a10;
for(i=0;i<MAX;i++)
for(j=0;j<MAX;j++)
cout<<*(*(pointer+i)+j)<<",";
_getch();
return 0;
}
|