PDF On Array New
PDF On Array New
Example:int a[10];
Compile time initialization:
process(1):int a[10]={10,21,3,20,65,42,51,58,35,11};
process(2):int a[]={10,21,3,20,65,42,51,58,35,11};
Memory Representation:
3.2 Declaration and initialization of two
dimensional arrays
• Multidimensional arrays may be initialized by specifying
bracketed values for each row.
• Following is an array with 3 rows and each row has 4
columns.
int a[3][4] = {
{0, 1, 2, 3} , /* initializers for row indexed by 0 */
{4, 5, 6, 7} , /* initializers for row indexed by 1
*/
{8, 9, 10, 11} /* initializers for row indexed by 2
*/
};
OR
• int a[3][4] = {0,1,2,3,4,5,6,7,8,9,10,11};
3.3 Declaration and initialization of
charecter arrays
When the above code is compiled and executed, it produces the following result −
a[0][0]: 0
a[0][1]: 0
a[1][0]: 1
a[1][1]: 2
a[2][0]: 2
a[2][1]: 4
a[3][0]: 3
a[3][1]: 6
a[4][0]: 4
a[4][1]: 8
QUESTIONS OR
ASSIGNMENTS