Basic

Switch Case

Goto

Operators

if Statement

Nested if

While Loop

For Loop

Array

Patterns

Excersises


Array in c program


Array is a collection of variables belongings to the same data type. You can store group of data of same data type in an array. Arrays are the derived data type in C programming language which can store the primitive type of data such as int, char, double, float, etc.

Example : pgm.c
#include<stdio.h>
int main(){
    int a[100];//400 byte
    int n,i;
    printf("\nEnter the Limit : ");
    scanf("%d",&n);
    printf("Enter %d Values : ",n);
    for(i=0;i<n;i++){
        printf("\nEnter the %d Value : ",i+1);
        scanf("%d",&a[i]);
    }
    printf("\nStored Values : ");
    for(i=0;i<n;i++){
        printf("\na[%d]=%d",i,a[i]);
    }
    return 0;
}

Output:

Enter the Limit : 5
Enter 5 Values :
Enter the 1 value : 10
Enter the 2 value : 20
Enter the 3 value : 30
Enter the 4 value : 40
Enter the 5 value : 50
Stored Values :
a[0]=10
a[1]=20
a[2]=30
a[3]=40
a[4]=50