ProAnswers.org

How to initialize an array in C

1 Like

Intialization of one dimensional arrays :-

1.At compile time



2.At run time



compile time :-



type array -name[size]={List of values}



Run time:-



ex-



------------------



for(i=o;i<100;i=i+1)



{



if i<50



sum[i]=0.0



else



sum[i]=1.0



}



-----------------------------



In two dimentional:-



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