Skip to main content

Posts

Showing posts with the label two dimensional array

Pointers and 2-Dimensional arrays in C programming

              Multi-dimensional array can also be represented with an equivalent pointer notation as in single dimensional array. A two dimensional array is actually a collection of one dimensional arrays. Therefore we can define a two dimensional array as a pointer to a group of contiguous one-dimensional arrays. Its general syntax is as   Data_type (*ptr_variable)[expression2];             Instead of          Data_type array[expression1][expression2];        Example:    Suppose x is a two dimensional integer array having 4 rows and 5 columns. We can declare x as int (*x)[5];    rather than int x[4][5];                     Here, in first declaration, x is defined to be a pointer to ...