Defining array in c lanaguage

      No Comments on Defining array in c lanaguage

Defining Array in c

This program illustrate the concept of defining array in c.

  • Array store the elements in contiguous memory location.
  • It can store a fixed-size sequential collection of elements of the same type.
  • The array size must be a integer type and it should be greater than 0.
  • In array the lowest address indicate the first element and the highest address indicate the last element.
  • Syntax to define array in java is “datatype arrayname[]=new datatype[size]”.
  • eg int x[]=new int[100].
  • Picture repersentation of array
  • defining array in c

    #include<stdio.h>
    #include<conio.h>
    void main()
    {
    int i,a[5];
    clrscr();
    a[0]=1;
    a[1]=2;
    a[2]=3;
    a[3]=4;
    a[4]=5;
    printf("Elements of array are:-\n");
    for(i=0;i<5;i++)
    {
     printf("%d\n",a[i]);
    }
    getch();
    }
    

    OUTPUT:-


    Comment below if you are facing any problem


    Also read

    Java simple program of defining array


    Summary
    Defining array in c lanaguage
    Article Name
    Defining array in c lanaguage
    Description
    This program illustrate the concept of defining array in c.Array can store a fixed-size sequential collection of elements of the same type.
    Author
    Publisher Name
    Scanfcode
    Publisher Logo

Leave a Reply

Your email address will not be published. Required fields are marked *