Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Does it make sense to insert an element into an array?
Does it make sense to insert an element into an array?
Inserting elements into an array makes sense.

Once an empty element is found in the array, a new element will be added, and when the if judges that the current element is empty, it will be added. You can view it in the final output array. The index can be used as a standard. At the end of the loop, the index is still-1, indicating that the array is full.

Take int array as an example: int [] array = new int [n]; Here n is the value you want to fill in. For example, 5 means that this integer array has 5 values, and then it can be assigned. Here n can also be left blank. For example, you define an integer variable n; By assigning a value to n, the length of the array can be determined, which is a dynamic change of the array length.

Array formula:

When entering a cell range, the dimension used should be the same as the array dimension calculated by this formula. In this way, Microsoft Excel can put each value in the calculated array into a cell in the array area.

If the array calculated by the array formula is smaller than the selected array area, Microsoft Excel will expand the array to fill the entire array area.

For example: ={ 1, 2; The expansion of 3,4} * 2 becomes ={ 1, 2; 3,4}*{2,2; 2,2}, and the corresponding calculation result is "2,4,6,8". Another example is: enter the formula ={ 1, 2; The expanded formula of 3,4} * {2,3} will become ={ 1, 2; 3,4}*{2,3; 2,3}, and the corresponding calculation result is "2,6,6, 12".