answersLogoWhite

0


Best Answer

#include<stdio.h>

#include<conio.h>

int main(void)

{

int a[10],i;//array declaration

clrscr();

printf("\n enter the elements of array");

for(i=0;i<10;i++)

scanf("%d",&a[i]);

printf("\n the elements you enter into the array");

for(i=0;i<10;i++)

printf("%5d",a[i]);

getch();

return 0;

}

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

You can access and store elements in an array using a[n] where a is the name of the array and n is the location.

Ex:

a[5] = 100; adds the value 100 to the 5th location in the array a

int i = a[5]; gets the 5th value from the array a and assigns it to the variable i which will have value 100.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you access and store the elements of array?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you read data from array?

Use the array suffix operator [] to access the individual elements of an array through a zero-based index.


How do you use subscripts with an array?

An array is a list of several related elements. You use the subscript to specify which element you want to access. For example, in Java you might have an array called myArray, with 10 elements (numbered from 0 to 9); myArray[3] would access the fourth element in the array. A variable may be used instead of a constant.


Is it the most efficient approach to access elements with the vector data structure?

Yes. A vector is a variable-length array but constant-time random-access is guaranteed regardless of an array's length.


How can two single dimensional array values be stored in a third single dimensional array?

You need to create a new array with enough elements to cater for both arrays. Thus if the first array has 10 elements and the second has 5, you must create a 15 element array to store both. You then copy elements from the first array into the third and immediately follow with the elements from the second. Note that the first two arrays must be of the same type. You cannot combine an array of numeric values with an array of strings, for instance.


What is an array and how do you create one How do you access information or elements contained in an array?

An array is:simply a collection of similar objectsHow you create one: (I think)Basically you receive or copy an image and place it in an array and assign it an mage Areray name.How you access info and elementsIt can be accessed by means of a variable name and an index.


What is array literal in as2?

An array literal is a comma-separated list of the elements of an array. An array literal can be used for initializing the elements of an array.


How do you declare a string array and add elements to it in C plus plus?

You cannot add elements to a fixed array in C or C++. If, however, the array is declared as a pointer to an array, you can add elements by allocating a new array, copying/adding elements as needed, reassigning the new array to the pointer, and deallocating the original array.


How do you access 2D array elements by using single variable?

int main() { int array[3][3]; int i; for(i=0; i &lt;9;i++) { printf("the element is %d\n", array[i/3][i%3]); } return 0; }


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.


What is faster access the element in an array or in a list?

Array is always faster to read from disk/access any element in the array is quicker since elements in a array are stored in contiguous location in the memory, you need the pointer to the head or 0th element in the array and then it much quick to navigate to the next on index based. But you need to know INDEX of the element for best results List (say linked list) will be slower since not always elements are stored in contiguous location in the memory as well it involves a function call which is can be assembler/cpu expensive. However getting an individual object from an array is faster if you know the index of the object. Walking through a linked list is faster than walking through an array, if you use a non-recursive algorithm. --Vinay Solanki


What are the different types of array explain with examples?

There are two main types of array:1) Single dimensional array: These are arrays for which only one index is required to access the element stored in an array. They are stored in a contiguous memory location.Eg:int arr[10];//declarationarr[7] = 7;//initialization2) Multidimensional array: These are arrays for which more than one index is required to access the element stored in a specific location in the array. These are stored in a contiguous memory location row-by-row.Eg:int arr[5][5];//two dimensional arrayint arr[5][5][5];//three dimensional array


What is a example of a array?

An ordered array is simply an array where all elements are in sorted order: int a[] = {3, 6, 9, 10, 15, 21}; // ordered array An array can either be initialised with ordered elements or the elements may be sorted after initialisation. When inserting new elements into an ordered array, the order must be maintained.