mercredi 18 mars 2015

C++ multidimensional arrays


I'm new to c++ and its developing. i used



static const int ipx[7][2] = { {-1, 0}, {-1, -1}, {-1, 1}, {-2, 0}, {-2, -1}, {-2, 1}, {0, 0} };


and when i prints the values of that array i got results as follows. could anyone please explain why this happens. Thank you



printf("-> %i \n",ipx[3][1]); // prints -> 0
printf("-> %i \n",ipx[7][1]); //prints-> 28
printf("-> %i \n",ipx[7][0]); //prints ->-> 1
printf("-> %i \n",ipx[5][1]); //prints -> 1


thank you in any advance.




Aucun commentaire:

Enregistrer un commentaire