vendredi 27 mars 2015

where is 2 dimensional array's size and how to use point to make 1 dimensional to 2?



just as the following code:



int a[100],b[10][10];


we declare two arrays,A 100 one dimensional and a 10*10 two dimensional.


My question is where is the size of b's line (10) store?


And,How could I use the type like c[][] to visit a element in a?


At present,I know two ways to do this,one is use define like



#define c[(x)][(y)] a[(x*10)+(y)]


the second is use memcpy to copy to a 2dimensional array.


Is there any other ways?


Thank you very much!




Aucun commentaire:

Enregistrer un commentaire