answersLogoWhite

0

How to make a program using array?

User Avatar

Anonymous

15y ago
Updated: 8/17/2019

An array is a variable name that can store several values, not just one. Each element is accessed through the variable name, combined with a subscript - a number used to distinguish the elements in the array.

Basically you usually would do each of the following:

  • Declare the variable
  • Initialize the array, that is, assign values to each element
  • Retrieve the values at some later point
Here is an example with Java:

// The following will both declare an array, and assign initial values to it
int myArray = {5, 10, 15}
// The following will show each of the values:
for (int i = 0; i < myArray.length(); i++)
System.out.println("Element # " + i + " has the value " + myArray[i];

Note that in Java, the element numbering starts at zero.
User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

Program to count the number of numbers in an array using 8085 microprocessor?

A program which is used to count the number of numbers in an array using a 8085 microprocessor is known as a assembly language program.


Sample program array using buffered reader?

system.exit o


How do you write a program to read set of numbers using by an array and display the ascending order of the given input numbers?

To write a C++ program to display the student details using class and array of object.


Can you give an example of array using character variable in c program?

the example of array over charcter variables is char ["string"]


What will be the program to arrange numbers stored in array in ascending order using pointers?

sorry


Write c program to find median?

If you are using an array : sort using qsort() then take middle element.


8086 assembly program to sort a list of integers?

assembly language program for sorting an array using 8086 microprocessor.


Write a c program to reverse an array without using another array?

public static int[] reverseArray(int[] array) { int i = 0, j = array.length - 1; for (i = 0; i &lt; array.length / 2; i++, j--) { int temp = array[i]; array[i] = array[j]; array[j] = temp; } return array; }


Sorting an array in PHP without using sort function?

plz as soon as possible give me the program for shorting an array in asscending order without using any sort function in c++


Program to print sorting of an array in clanguage?

/* PROGRAM TO SORT ARRAY ELEMENTS USING BUBBLE SORT*/ #include #include void main() { int i,j,n,t,a[50]; clrscr(); printf("ENTER THE ARRAY SIZE:\n"); scanf("%d",&amp;n); printf("ENTER THE ARRAY ELEMENTS:\n"); for(i=0;i


How do you write an assembly language program to find the sum of n numbers using array?

write an assembly language program to find sum of N numbers


You want to write a simple without using pointer or array c program which will print greatest number when you give 20 number?

i want to write a simple without using pointer or array c program which will print greatest number when i give 20 number .........How far have you gotten so far?