Chapter

Contiguous 2-D Arrays

From ComputerScienceOne by Dr Chris Bourke

Concepts

  1. Why use a contiguous memory block for a two-dimensional array?

    "The example depicted in Figure 20.1 constructs a two dimensional array. However, each “row” of the array was created using an independent call to malloc() which may result in non-contiguous memory bl

  2. How can pointer manipulation create a contiguous two-dimensional array?

    "In the following example, we will create a 4 × 3 sized matrix.\n\n1 int **m = (int **) malloc(sizeof(int *) * 4);\n\n2 m[0] = (int *) malloc(sizeof(int) * (4 * 3));\n\nWe’re not done yet, however. We

Contiguous 2-D Arrays | ComputerScienceOne | Bifalgorithm | Bifalgorithm