Definition of the array:
First, the correct wording:
1.int ages[5]--defines an array of 5-length int types
2.int ages[]={1,2,3,4,5};--defines an array of type int of 5 length, and initializes the value of the array
3.int ages[5]={10};--defines an array of type int of 5 length, and gives ages[0]=10;
Second, the wrong wording:
1.int a[]; 2.int[5] A--c#,java The method of defining an array in the language, be sure to differentiate it from the C language!
2.int a[] = {10,12,13}; The name of the a={11,15,16};--array represents the address of the array in memory and can be considered a constant
Three, array and function, involved in the pointer, later detailed description
1#include <stdio.h>2 voidChangeint);3 voidChange2 (int []);4 5 intMain ()6 {7 intages[Ten] = {Ten, One, -, the, -};8 9 //printf ("Number of bytes occupied by the array:%ld\n", sizeof (Ages));Ten One //Change (ages[1]); A - Change2 (ages); - theprintf"ages[1]=%d\n", ages[1]); - - return 0; - } + - //When an array is a function parameter, the number of array elements can be omitted + //When an array is a function parameter, the pass is the address of the array, and the array and ages share a piece of storage space A //always 8 (64bit) when calculating the number of bytes in a parameter group within a function at //since the system will be a parameter group to a pointer type, the pointer type will always be 8 bytes - voidChange2 (intarray[]) - { -printf"number of bytes occupied by the array:%ld\n",sizeof(array)); - - inarray[1] = -; - } to + //when a basic data type is a function parameter, only the value is passed - //Modifying the parameters inside the function does not affect the outside arguments the voidChangeinta) * { $A =Ten;Panax Notoginseng}
C an array of base--c languages