Write a Program to illustrate Array?
int x[100];
char text[80];
float temp[30];
static int marks[5];
We are able to use symbolic constants instead of expression. The value of the symbolic constant will be substituted for the constant / expression itself before the compilation process. Consequently in order to alter the program to accommodate a different size array only the # define statement must be changed.
# define SIZE 60
main()
{
char letter[SIZE];
......................
......................
}
Let us at present see how to initialize an array while declaring it. . Following are some illustration which demonstrates this.
static int al[6] == {2,4,6,5,15,12 } ;
float bl[] == {12.3,34.2,-11.3} ;
If the array is initialized when it is declared after that its storage class must be either static or extern. If the variable is declared as extern or static and its value will not change accidentally during the execution of the program.