answersLogoWhite

0

Prog to display array element

Updated: 8/17/2019
User Avatar

Wiki User

14y ago

Best Answer
Java solutionFortunately, Java has a number of useful functions in the java.util.Arrays class for us.
A call to...
System.out.println(java.util.Arrays.toString(array));
...will print out any array.
User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Prog to display array element
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How to display the content of memory address stored in an element of an array?

void *array[2]; printf ("array[%d]=%p\n", i, array[i]);


How do you display 15 numbers in an ascending order using an array?

Sort the array then traverse the array, printing the element values as you go.


Accept 5 numbers in an array and display it?

Accept 5 numbers in an array and display it.


Will an array element be deleted when you retrieve it from the array?

You cannot delete from an array.


How do you find particular element in array?

by using index position we can find the particular element in array.


Which element of array does this expression refer num5?

which element of the array does this expression reference num[5]


What is the index number of the last element of an array with 9 elements?

(array.length - 1) will find the index of the last element in an array (or -1 if the array is empty).


How do you represent binary tree using array?

The root of the tree is stored in array element [0]; for any node of the tree that is stored in array element [i], its left child is stored in array element [2*i], its right child at [2*i+2]


What search begin the search with the first array element?

The search for the first array element begins at the assembly plant. As they array is being constructed, the element itself is one of the first components to be completed.


How do you display the contents of the memory addresses stored in an element of pointer array?

Every element of a pointer array is a pointer, therefore to access the memory being pointed at by an element, dereference the element. For example: #include<iostream> int main (void) { int* a[10] = {nullptr}; for (int i=0; i<10; ++i) { a[i] = new int (i+1); } std::cout << "Address of array:\n"; std::cout << "a = 0x" << &a << std::endl; std::cout << "Address of each element in the array:\n"; for (int i=0; i<10; ++i) { std::cout << "a[" << i << "] = 0x" << &a[i] << std::endl; } std::cout << "Value of each element in the array:\n"; for (int i=0; i<10; ++i) { std::cout << "a[" << i << "] = 0x" << a[i] << std::endl; } std::cout << "Dereferenced value of each element in the array:\n"; for (int i=0; i<10; ++i) { std::cout << "a[" << i << "] = " << *a[i] << std::endl; } for (int i=0; i<10; ++i) { delete a[i]; } }


Is it necessary to read or display the elements of an array in order of its subscripts?

By no means; you can access any random array element. If you have ever seen examples which process them in order, it is because of the following: when the order doesn't matter (for example, you want to calculate the sum of all the array elements), it is easiest to process them in order.


How do you return an array from function?

By returning a pointer to the first element of the array.