web analytics

Write down the initialization of two dimensional array

Initialization of two dimensional array : Like the one dimensional arrays, two dimensional arrays may be initialized by following their declaration with a list of initial values enclosed in braces. For example,


                   int table[2][3]={0,0,0,1,1,1};

This initializes the elements of the first row to 0 and the second row to 1. This statement can also be written as,

                   int table[2][3]={{0,0,0}, {1,1,1}};

This can also be written as,

                   int table[2][3]=   {
                                                          {0,0,0},
                                                          {1,1,1}

                                                };
Please follow and like us:
Pin Share
RSS
Follow by Email
Scroll to Top