What Is Array In C Programming ? Basic Program Of Array |


Array...

1. Array is derived Data type which is constructed by the help of primitive datatype.

2. Array is a variable which store more then one value of same datatype in continuous memory location.

3. Array can not contain dis similar type of data.

4. Array index always begin with unique identification a[0] called base index of array.

5. The size of array index is always 0 to n-1.

6. We can perform array in two way-

> One dimensional array. 

> Two dimensional array.

Syntex...

<Data type><Variable-names>[size of array];

Ex. - iint arr[10];

Code For Array program---

#include <stdio.h>

int main(int argcchar const *argv[])
{
    int marks[2][4] = {{1234}, {5678}};

    /* for (int i = 0; i < 4; i++)
    {
        printf("enter the value of %d element of the array\n", i);
        scanf("%d", &marks[i]);
    } 
    for (int i = 0; i < 4; i++)
    {
        printf("enter the value of %d element of the array is %d\n",i, marks[i]);
    } */

    for (int i = 0i < 2i++)
    {
        for (int j = 0j < 4j++)
        {
            /* code */

            // printf("enter the value of %d,%d element of the array is %d\n", i,j, marks[i][j]);
            printf("%d "marks[i][j]);
        }
        printf("\n");
    }

    // marks[0] = 88;
    // printf("marks of student 1 is %d\n" , marks[0]);
    // marks[2] = 90;
    //
    // printf("marks of student 2 is %d" , marks[2]);

    return 0;
}


Comments