• oc gay chat rooms

    Answered By:
    chat gay granada
  • gay dating

    Answered By:
    international gay dating websites
  • 2finishing

    Answered By:
  • An array is a collection of items stored at contiguous memory locations. The idea is to store multiple items of the same type together. This makes it easier to calculate the position of each element by simply adding an offset to a base value, i.e., the memory location of the first element of the array (generally denoted by the name of the array).

    An array is stored such that the position of each element can be computed from its index tuple by a mathematical formula. The simplest type of data structure is a linear array, also called one-dimensional array.


    The array is a fixed-size sequenced collection of variables belonging to the same data types. The array has adjacent memory locations to store values. Since the array provides a convenient structure for representing data, it falls under the category of the data structures in C. The syntax for declaring array are:

    data_type array_name [array_size];

    Following are the essential terminologies used for understanding the concepts of Arrays:

    Element: Every item stored in an array is termed as an element

    Index: each memory location of an element in an array is denoted by a numerical index which is used for identifying the element

    When a program works with many variables which hold comparable forms of data, then organizational and managerial difficulty quickly arise. If you are not using arrays, then the number of variables used will increase. Using the array, the number of variables reduces, i.e., you can use a single name for multiple values, you need to deal with its index values (starting from 0 to n).

    So if the total run of each player is getting stored in separate variables, using arrays you can bring them all into one array having single name like: plrscore[11];



    Arrays are particularly helpful for making a collection of input data which arrive in random order. An excellent example will be vote counting: You can write a program which tallies the votes of a four-candidate in an election. (For your ease, you will say use the candidates' names as Cand 0, Cand 1, Cand 2, and Cand 3.) Votes arrive once at a time, where a vote for Candidate i is denoted by the number, i. So according to this example, two votes for Cand 3 followed by one vote for Cand 0 would appear:

    and so on....

    i.e., the structure will be:

    int votes[4];

    There is some specific operation that can be performed or those that are supported by the array. These are:

    • Traversing: It prints all the array elements one after another.
    • Inserting: It adds an element at given index.
    • Deleting: It is used to delete an element at given index.
    • Searching: It searches for an element(s) using given index or by value.
    • Updating: It is used to update an element at given index.


    Answered By:



Ask Question