Question

what is array

what is array

Homework Answers

Answer #1

An array is a collection of elements. We can use array to store some specific number of elements depending on the size of the array.

For example, in C:

int array[10];

creates an array that can store 10 integer values. In C, array is a collection of homogeneous elements. That means it can hold elements of only a specific data type.

In the above example, the array can hold only integer values.

Here, the array index starts from 0 and the index of last element will be 9.

We can assign values in array using assignment operator.

array[0] = 10 assigns 10 as the first element of the array.

Also we can retrieve the stored value using the index value.

array[0] returns 10.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Assuming an integer array is dynamically allocated: int *array = new int[10]; What is the correct...
Assuming an integer array is dynamically allocated: int *array = new int[10]; What is the correct way of deallocating this array to not cause any memory leaks? delete array[10]; delete array; delete [10] array; delete *array; delete [] array;
For a transmit array consisting of 5 identical antennas, what is the maximum array gain it...
For a transmit array consisting of 5 identical antennas, what is the maximum array gain it can achieve when the transmitter has the channel state information? What happens when the transmitter does not have the channel state information?
int i,sum=0;   int array[8]={//You decide this};   int *a,*b,*c;   a = array;   b = &array[3];   c =...
int i,sum=0;   int array[8]={//You decide this};   int *a,*b,*c;   a = array;   b = &array[3];   c = &array[5];   c[-1] = 2;   array[1] = b[1]-1;   *(c+1) = (b[-1]=5) + 2;   sum += *(a+2) + *(b+2) + *(c+2);   printf("%d %d %d %d\n", sum, array[b-a], array[c-a], *a-*b); array[8]={ ?? }; what is array[8]?
what is an 'almost sorted' or 'K-sorted' array?
what is an 'almost sorted' or 'K-sorted' array?
Antenna Array (a) Construct the array factor for an arbitrary linear array along the X-axis. (b)...
Antenna Array (a) Construct the array factor for an arbitrary linear array along the X-axis. (b) For the special case of a two elements with λ spacing and equal amplitude and phase, determine the array factor. (c) Make plots of the array factor in the three coordinate planes, XY, XZ, and YZ. (d) If half-wavelength dipoles are used as the array elements and they are oriented along the Z axis, plot the complete array patterns in all three planes.
An array is sorted (in ascending order) if each element of the array is less than...
An array is sorted (in ascending order) if each element of the array is less than or equal to the next element. An array of size 0 or 1 is sorted Compare the first two elements of the array; if they are out of order, the array is not sorted; otherwise, check the if the rest of the array is sorted. Write a boolean-valued method named isSorted that accepts an integer array, and the number of elements in the array...
Write a program in c++ to Convert an array of inches to an array of centimeters....
Write a program in c++ to Convert an array of inches to an array of centimeters. The program should contain a function called inchesTOcm with three parameters (inches array that contains the values in inches, cm array to save the result in, and an integer variable that defines the length of the array). In the main function: 1. Define an array (inches) of length 3. 2. Initialize the array by asking the user to input the values of its elements....
The elements of an integer-valued array can be set to 0 (i.e., the array can be...
The elements of an integer-valued array can be set to 0 (i.e., the array can be cleared) recursively as follows: An array of size 0 is already cleared; Otherwise, set the last of the uncleared elements of the array to 0, and clear the rest of the array Write a void method named clear that accepts an integer array, and the number of elements in the array and sets the elements of the array to 0. Need it to be...
Write a recursive array that gives the min of an array C
Write a recursive array that gives the min of an array C
An array contains 10 elements. What is the maximum number of swaps required to convert the...
An array contains 10 elements. What is the maximum number of swaps required to convert the array to a max heap?