C Programming
Array
Array is collection of more than one variables having same name, same data type with different index value. Basically array is useful to store multiple value of same type in continous momory.
The general format is
data type array name[size];
Exp. int arr[5];
Note:
- Here arr is an array name of integer data type with 5 memory location. The starting index is 0 and last index is 4. arr[0] arr[1] arr[2] arr[3] arr[4]
- The first value of array will store in arr[0], second value will store in arr[1] and last element of array will store in arr[4] location of array.
- The name of the array is constant pointer.
Writer a c program to accept the value of 10 product and print it.
#include<stdio.h>
#include<conio.h>
void main()
{
int prod[10], i;
for(i=0;i<10;i++)
{
printf("Enter 10 product value");
scanf("%d", &prod[i]);
}
for(i=0;i<10;i++)
{
printf("%d",prod[i]);
}
getch();
}
Output
Sample Input: 5 10 12 13 15 14 17 18 19 25
Output: 5 10 12 13 15 14 17 18 19 25