A 2D array can be constructed using a 1D array in which each row of the 2D array is placed one after another.

If a 2D array with mm rows and nn columns is stored in this fashion, what will be the index of the element at row i and column j of the 2D array.

Note: Assume all zero-based indexing *

Respuesta :

Use the knowledge in computational language in python to write the array with mm rows and nn columns is stored in this fashion.

How to define array in Python?

Arrays are similar data structures to Python lists, but not as flexible. In an array all elements must be of the same type, typically numeric, such as int or float. Also, the size of an array cannot be modified, unlike lists that can grow dynamically. In contrast, using arrays is much more efficient and makes it easier to compute large volumes of numerical data. This makes arrays particularly useful in scientific computing.

So in an easier way we have that the code is:

int my2dArr[10][10];  

int (*myPtr)[100] = my2dArr;  

for (int i=0;i<10;i++)

 for (int j=0;j<10;j++)

   my2dArr[i][j]=i*10+j;  

for (int i=0;i<10;i++)

 for (int j=0;j<10;j++)

   printf("[%d][%d] = %d\n", i, j, myPtr[i*10+j);

See more about python at brainly.com/question/18502436

Ver imagen lhmarianateixeira
ACCESS MORE