正在加载图片...
The c Programming language Chapter 7 Arrays 57.1 One-dimensional Arrays ☆ Declaration: specifies the number of elements in the array type array name [constant integral expression] subscript operator as int 1=15 int data 1 /xthe expression can not be variable tny can make reference to eaer elements one by one, > Array element:asa付(i as as int a 101 printf(" %,, a);(×) for(=0;j<10;j++) printf( %odt, aLDThe C Programming Language Chapter 7 Arrays § 7.1 One-dimensional Arrays ❖ Declaration: type array name[constant integral expression]; valid identifier specifies the number of elements in the array; [ ] :subscript operator precedence:(1) as int a[6] ; 0can not a[use 0] ( ) 1 4 5 a[1] a[2] a[3] a[4] a[5] 2 3 a ❖ Reference: ➢ Arrays must be declared before use; ➢ Only can make reference to each elements one by one; ➢ Array element : as a[i] ( i: 0~N-1) as int i=15; int data[i]; //the expression can not be variable as int data[5]; data[5]=10; //out of range as int a[10]; printf(“%d”,a); () => for(j=0; j<10; j++) printf(“%d\t”,a[j]); ()
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有