Question: C language 1.9 Let's examine the pointer version: Observe the first step, where we allocate space for 3 pointers: B2 -Cdouble ** malloc (sizeof (double*3);
C language
1.9




Let's examine the pointer version: Observe the first step, where we allocate space for 3 pointers: B2 -Cdouble ** malloc (sizeof (double*3); Let's tease this apart: First, consider the argument to malloc: B2-Cdouble * malloc (sizeof (double*3); This says that we are requesting 3 contiguous spots where each spot is large enough to hold a pointer-to-a-double B2- double **) malloc (sizeof double*) *3); The retum value from malloc is the address (pointer) to that 3-sized array of double-pointers. . Hence, it is a pointer to a pointer: B2 = (double **) malloc (sizeof(double*) * 3); . Next, we need each row of the 2D array: for Ci-0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
