正在加载图片...
The c Programming language Chapter 7 Arrays ☆ Initialization as int al!51={1,2,34.5} >:a[0}1;a[1]2;a[2}=3;a[3]=4;a4]=5 >S pecifications Without initialization, array elements are random numbers When a list of initializers is shorter than the number of array elements the remaining elements are initialized to zero inta[5}={6,2,3} a0=6;a[l]=2;a[2]}=3;a[3]=0;a[4]=0 as inta[31=62351 ×) as int al={1,2,3,4,5,6}; // the size of the array is 6The C Programming Language Chapter 7 Arrays ❖ Initialization ➢ Specifications: ⚫Without initialization, array elements are random numbers. ⚫If an array is declared without a size and is initialized to a series of values ,it is implicitly given the size of the number of initializers. as int a[5]={6,2,3}; =>: a[0]=6; a[1]=2;a[2]=3; a[3]=0; a[4]=0; as int a[3]={6,2,3,5,1}; () ⚫When a list of initializers is shorter than the number of array elements ,the remaining elements are initialized to zero. as int a[]={1,2,3,4,5,6}; // the size of the array is 6 ➢as int a[5] ={1,2,3,4,5}; =>:a[0]=1; a[1]=2; a[2]=3; a[3]=4; a[4]=5;
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有