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?
What is the difference between the following two declarations? char array[] = “Hello World”; char *array...
What is the difference between the following two declarations? char array[] = “Hello World”; char *array = “Hello World”;
What values will be written to the array when the following code executes? .data array DWORD...
What values will be written to the array when the following code executes? .data array DWORD 4 DUP(0) .code main PROC mov eax,10 mov esi,0 call proc_1 add esi,4 add eax,10 mov array[esi],eax INVOKE ExitProcess,0 main ENDP proc_1 PROC call proc_2 add esi,4 add eax,10 mov array[esi],eax ret proc_1 ENDP proc_2 PROC call proc_3 add esi,4 add eax,10 mov array[esi],eax ret proc_2 ENDP proc_3 PROC mov array[esi],eax ret proc_3 ENDP
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.
Write a function that passes an array argument, getRandomNumbers, to get a pointer to an array...
Write a function that passes an array argument, getRandomNumbers, to get a pointer to an array of random numbers in the array. The function dynamically allocates an array, uses the system clock to seed the random number generator, populates the array with random values, and then returns a pointer to the array. Function getRandomNumbers to generate a random array and return a pointer. int* getRandomNumbers(int num); // The parameter indicates the number of numbers requested. The algorithm can be described...
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....
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT