C compiler checks on the array bounds and report errors, if any, at compile time. 30. While executing a program, a value of an array type can be null or a reference to an instance of
that array type.
31. Initialization of an array may be combined with instantiation by using initializers.
32.
Array elements are initialized to their default values, if they are not explicitly initialized by
using initializers, when an instance is created.
We are in a position to solve some questions based on 1D arrays now. Q1. Write a C program that reads 10 integer elements and displays them.
Solution 1: The program is as follows:
#include main( )
{
int val[10];
int i;
printf(“\n\tEnter the array elements:”);
for (i =0; i<10; i++)
scanf(“%d”, &val[i]);
printf(“\n\tArray elements are: “);
for (i = 0; i <10; i++)
printf(“\n%d”, val[i]);
}