answersLogoWhite

0


Best Answer

Generally, a array is fixed in size. With some libraries, however, they are extensible, either by reallocation/copying strategies (C/C++/STL), or by linking/referencing strategies (JAVA).

User Avatar

Wiki User

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

Wiki User

13y ago

Yes

If you need a variable sized array then a pointer is needed that has the memory assigned to it with realloc.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Is the array size is fixed after it is created?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Why fixed size array is not efficient?

It's not exactly true. Array with fixes size are efficient, but do not work well when you have to resize your array. This actually is the answer for your question. Fixed size arrays are not efficient if you have to change the size. Also you cannot destroy them and release memory used to save the array (for that you have to use operator new).


What is the difference between a fixed size array and a variable size array?

The obvious answer is that one has a constant size while the other does not. More specifically, a fixed-size array is one where the size is known at compile time and does not change at runtime. By contrast, the size of a variable-sized array may or may not be known at compile time but may change at runtime. We often refer to a variable-size array as being a dynamic array, however some people (myself included) incorrectly refer to a fixed-size array as being a static array. The misunderstanding largely comes from the fact that we often refer to the heap (or free store) as being dynamic memory because all dynamic variables are allocated there (including variable-size arrays). But the term dynamic array does not refer to the memory, it refers to the dynamic -- as in changeable -- nature of the array itself. By contrast, a fixed-size array is only deemed static if it is statically allocated, in which case it will be allocated in the program's data segment along with all other static variables, global variables and constants. But a local fixed-size array is allocated on the program's stack and is therefore, by definition, non-static. Moreover, you can allocate a fixed-size array on the heap!


How do you find missing numbers in a array with elements below its size?

Please rephrase your question. An array usually has a fixed size and I don't recall ever having to "go below its size". This implies that the missing elements are not within the range of the array.


Difference between loop and array?

A loop usually referred to the program flow control with possible repetition of executing the same codes, an array is an abstraction of fixed size container. 2 different concepts.


Why would you use the array of pointers to pointers?

You would use an array of pointers to pointers whenever you wished to implement a dynamic multi-dimensional array of 3 or more dimensions. Every multi-dimensional array can ultimately be reduced to a one-dimensional array where each element is itself a one-dimensional array (an array of arrays). With fixed-size arrays, all elements can be allocated contiguously regardless of how many dimensions there are. Fixed size arrays can be allocated both statically (when the size is known at compile time) or dynamically (when the size is unknown at compile time). However with large arrays it is often necessary to divide the array into smaller subarrays each of which is allocated separately (non-contiguously with each other) and maintain a separate array of pointers to keep track of each of those subarrays. Although this consumes more memory than a contiguously-allocated array would, it has the added benefit in that each subarray need not be the same length, thus it can actually save memory overall. However, if we had several such arrays then we would need yet another array in order to keep track of them all, and this array would need to be an array of pointers to pointers.

Related questions

Why fixed size array is not efficient?

It's not exactly true. Array with fixes size are efficient, but do not work well when you have to resize your array. This actually is the answer for your question. Fixed size arrays are not efficient if you have to change the size. Also you cannot destroy them and release memory used to save the array (for that you have to use operator new).


What is the difference between a fixed size array and a variable size array?

The obvious answer is that one has a constant size while the other does not. More specifically, a fixed-size array is one where the size is known at compile time and does not change at runtime. By contrast, the size of a variable-sized array may or may not be known at compile time but may change at runtime. We often refer to a variable-size array as being a dynamic array, however some people (myself included) incorrectly refer to a fixed-size array as being a static array. The misunderstanding largely comes from the fact that we often refer to the heap (or free store) as being dynamic memory because all dynamic variables are allocated there (including variable-size arrays). But the term dynamic array does not refer to the memory, it refers to the dynamic -- as in changeable -- nature of the array itself. By contrast, a fixed-size array is only deemed static if it is statically allocated, in which case it will be allocated in the program's data segment along with all other static variables, global variables and constants. But a local fixed-size array is allocated on the program's stack and is therefore, by definition, non-static. Moreover, you can allocate a fixed-size array on the heap!


Is an array is a collection of characters that can be fixed or variable?

No. An array is a collection of objects of any type, such as doubles, not just characters. You can even have arrays of arrays, or arrays of structs. In C, the size of an array is fixed, but it is possible to write code that will allow you to manually make it variable in size.


How do you find missing numbers in a array with elements below its size?

Please rephrase your question. An array usually has a fixed size and I don't recall ever having to "go below its size". This implies that the missing elements are not within the range of the array.


Sample program of single-dimentional array?

#include "stdio.h" #define SIZE 100; void main() { int array[SIZE], i, size; printf("\nEnter the Size off Array :- "); scanf("%d", &size); printf("\nEnter the Elements of Array :- ")' for(i = 0; i < size; i++) scanf("%d", &array[i]; printf("\nThe Elements of entered Array :- "); for(i = 0; i < size; i++) printf("%7d", array[i]); }


Difference between loop and array?

A loop usually referred to the program flow control with possible repetition of executing the same codes, an array is an abstraction of fixed size container. 2 different concepts.


What is a bounded array?

A bounded array is an array data structure with a fixed size or capacity. It has a predetermined maximum number of elements that it can hold, and attempting to exceed this limit will result in an error or exception. This can be beneficial for memory management and preventing buffer overflows.


Diffbetween array and arraylist?

An array is a fixed-length chunk of memory. Once you've created an array, you can't change its length. This can be a problem. So we have ArrayList. This is a data structure backed by an array. You can add/remove/insert elements whenever and wherever you want and the code behind the scenes will take care of resizing the array for you.


Is there a way to use a variable to declare the size of an array in true basic?

! variable to declase the size of an array in True Basic ! set up a dummy value for array - any initial value > 0 is fine. DIM array$(999) ! ask the user for the length of the array INPUT PROMPT "Enter array size " :size ! resize the array with user defined length MAT REDIM array$(size) ! program end END


Why would you use the array of pointers to pointers?

You would use an array of pointers to pointers whenever you wished to implement a dynamic multi-dimensional array of 3 or more dimensions. Every multi-dimensional array can ultimately be reduced to a one-dimensional array where each element is itself a one-dimensional array (an array of arrays). With fixed-size arrays, all elements can be allocated contiguously regardless of how many dimensions there are. Fixed size arrays can be allocated both statically (when the size is known at compile time) or dynamically (when the size is unknown at compile time). However with large arrays it is often necessary to divide the array into smaller subarrays each of which is allocated separately (non-contiguously with each other) and maintain a separate array of pointers to keep track of each of those subarrays. Although this consumes more memory than a contiguously-allocated array would, it has the added benefit in that each subarray need not be the same length, thus it can actually save memory overall. However, if we had several such arrays then we would need yet another array in order to keep track of them all, and this array would need to be an array of pointers to pointers.


When was ARRAY Magazine created?

ARRAY Magazine was created in 2003.


When was Array Networks created?

Array Networks was created in 2000.