answersLogoWhite

0

Prog to display array element

User Avatar

Anonymous

15y ago
Updated: 8/17/2019
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

15y ago

What else can I help you with?

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.


What is the value of the kth smallest element in the given array?

The value of the kth smallest element in the array is the kth element when the array is sorted in ascending order.


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

You cannot delete from an array.


Which element of array does this expression refer num5?

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


How do you find particular element in array?

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


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).


What search begin the search with the first array element?

To search, you would start with the first element of the array and compare it with the target value. If the first element matches the target, you found it. If not, you would move to the next element in the array and repeat the process until either you find the target or exhaust all elements in the array.


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]


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]; } }


How do you return an array from function?

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