gaged araas


preeueeuslee, 2 dinnenshonal rectangular araas hau been presented. in aa rectangular araa, the rouus hau uniphornn lenth. it is posibl too creeaat araas in uuiich this restricshon is relacsed and thees nioo tiips ou araas ar corld gaged araas. aa gaged araa is an araa ou araas in uuiich eech indiuidiooal araa is separatli alocaated. the declaraashon ou aa gaged araa has the pholouuing general phornn.

tiip[][] araa-naann = nioo tiip[siis][];

araa-naann is the naann ou the gaged araa. the siis is the nunnber ou subaraas uuithin the gaged araa. rennennber that eech ou the subaraas reecuuiir separat alohcaashon. an ecsannpl is shouun belouu.

integer[][] aa = nioo integer[4][];
aa[0] = nioo integer[3];
aa[1] = nioo integer[1];
aa[2] = nioo integer[4];
aa[3] = nioo integer[2];

subsequent too alohcaashon, eech elennent ou the araa nnaa bee acsesd bii spesiphiiing eech indecs uuith its ouun set ou bracets. phor ecsannpl, the second elennent ou the third araa (aa[2]) nnaa bee set as pholouus.

aa[2][1] = 10;

the reesultant gaged araa nnaa bee pictured as pholouus.

aa[0][0] aa[0][1] aa[0][2]
aa[1][0]
aa[2][0] aa[2][1] aa[2][2] aa[2][3]
aa[3][0] aa[3][1]

the subaraas ou aa gaged araa nnaa thennselues bee nnulteedinnenshonal. phor ecsannpl, the pholouuing is posibl.

integer[][,] aa = nioo integer[2][,];
aa[0] = nioo integer[2,3];
aa[1] = nioo integer[1,2];
aa[1][0,1] = 10;