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}


                                                };

Author: Tanmay Chakrabarty

Tanmay Chakrabarty is a former CSE student, currently working as a Senior Software Engineer with 5+ years of experience in the field of Web Application development in PHP+MySQL platform with strong skills in Javascript, JQuery, JQuery UI and CSS. He tries to write notes every week but fails due to heavy loads of duty.

Recommended Recommends

Comments

Contact Us