Arrays in C Programming - Array in C



 Arrays in C Programming

Learn c - c tutorial - Arrays in C Programming - c examples - c programs

Arrays in C Programming

  • An array is a collection of data items, all of the same type, accessed using a common name.
  • A one-dimensional array is like a list; A two dimensional array is like a table; The C language places no limits on the number of dimensions in an array, though specific implementations.
  • Some texts refer to one-dimensional arrays as vectors, two-dimensional arrays as matrices, and use the general term arrays when the number of dimensions is unspecified or unimportant.
  • Object that holds a fixed number of values and an array is a container of one type.
  • The length of an array is established is created after creation and its length is fixed.
 Arrays in C Programming

Learn c - c tutorial - Arrays in C Programming - c examples - c programs

Sample Code

#include <stdio.h>
int main()
{
    int marks[5]= {98,89,77,10,34};
    int i; //loop counter
    printf("Marks are:\n");
    for(i=0; i< 5; i++)
        printf("marks[%d]: %d\n",i,marks[i]);
    printf("\n");
    return 0;
}

Output

Marks are:
marks[0]: 98
marks[1]: 89
marks[2]: 77
marks[3]: 10
marks[4]: 34


View More Quick Examples


Related Searches to Arrays in C Programming - Array in C