This is the basic array program which takes 2 array elements as input and gives that elements as output.PHP Code:
// testing arrays
# include <stdio.h>
void main()
{
int a[2],i;
printf("\nenter elements of array A");
for (i=0;i<=1;i++)
{
printf("\nenter element =");
scanf("%d",&a[i]);
}
printf("\nthe entered array is %d ",a[2]);
}
I don't understand why my compiler is showing output as 2 no matter what you enter.
I use gcc in Ubuntu OS