/* Fixed-length array:
can have any storage class.
Variable-length arrays:
Can only have an automatic life cycle (defined within a statement block, optimised does not have a static modifier).
The name must be a generic identifier, so a struct or union member cannot be an identifier for an array.
Reading and writing array data can be indexed and pointer-by-two methods.
*/
#include <stdio.h>inta[Ten];//with external linksStatic intb[Ten];//has a static life cycle and scopevoidParray (intCountintarr[]) { //Indexed Access for(intI=0; i<count; i++) {printf ("The %d is:%d \ n", I, arr[i]); } //pointer Access for(int*p = arr; P < arr + count; ++p) {printf ("p The value is:%d \ n", *p); }}intMainintargcChar*argv[]) { Static intc[Ten];//static life cycle and statement block scope//int d[10]; //has self-life cycle and statement block scope intvla[2*ARGC];//automatic life cycle, variable-length array//error:variable length Array declaration can not have ' static ' storage duration//static int e[n]; //refined life cycle, cannot be a variable length array//Error:fields must has a constant size: ' variable length array in structure ' extension'll never be supported
//struct S {int f[n]};//Small labels cannot be long variable array names structSintf[Ten]; };//Small labels cannot be long variable array names//Multidimensional Arrays extern inta2d[][5]; //int A3d[2][2][3] = {{{110,111,112},{120,121,122}},{{210,211,212},{220,221,222}}}; //int A3d[][2][3] = {{{1},{4}},{{7,8}}}; //int A3d[2][2][3] = {{1,0,0,4}, {7,8}}; //int A3d[2][2][3] = {1, [0][1][0]=4, [1][0][0]=7,8}; inta3d[2][2][3] = {{1}, [0][1]=4, [1][0]={7,8}}; //Initialize//int d[] = {n/a}; //D[0] = 1, d[1]=2, d[2]=3; intd[Ten] = {1,2,3,[6]=6};//initializing a specific elementParray (Ten, D); return 1;}
[ASM C + +] C-language arrays