1.

How is multidimensional arrays defined in terms of an array of pointer? What does each pointer represent? 

Answer»

An element in a multidimensional array like two-dimensional array can be represented by pointer expression as follows: 

*(*(a+i)+j)

It represent the element a[i][j]. The base address of the array a is &a[0][0] and starting at this address, the compiler allocates contiguous space for all the element row-wise. The first element of second row is immediately after last element of first row and so on. 



Discussion

No Comment Found

Related InterviewSolutions