answersLogoWhite

0

Yes, arrays can be created dynamically. The following shows how it can be done in C:

void f (unsigned n) {

int* p = malloc (n * sizeof (int)); /* allocate memory to accommodate n integers */

/* use p... */

free (p);

p = 0;

}

User Avatar

Wiki User

9y ago

What else can I help you with?

Related Questions

Dynamically allocated array waste storage and time?

It's actually not true. In order to make a good program which can work with big arrays you have to use dynamic arrays because you can cleam memory used by dymanic arrays any time. For static arrays is not true, memery which was reserved for static arrays will be available for other applications only when you finish working with your application (which is working with static arrays).


Are numpy arrays mutable, meaning can their values be changed after they are created?

Yes, numpy arrays are mutable, which means that their values can be changed after they are created.


What is the differnce between linked list and arrays?

A linked list is a series of elements, each containing a pointer or index to the next element in the list. You can dynamically add and delete elements in the list. An array is a contiguous block of repeated elements. Since each element is address-wise adjacent to the next element, there is no need for pointers or indexes to the "next" element. You can not dynamically add and delete elements in an array, although you can create "dynamic arrays" with (templates and) classes that auto-resize themselves. The STL does this for you, but it is a good exercise to implement it yourself.


What is multidimentional array?

Arrays having more than one dimension is known as multi-dimensional arrays. Multi-dimensional arrays is also known as arrays-of-arrays.


What is a multidimentional array?

Arrays having more than one dimension is known as multi-dimensional arrays. Multi-dimensional arrays is also known as arrays-of-arrays.


What is a PHP function that can sort arrays by other arrays?

You cannot sort arrays by other arrays; that wouldn't make sense, anyway.


Can ragged arrays created by using java?

I assume you mean that you have a number of rows, and that not all rows have the same number of "cells". Yes, in Java a two-dimensional array is implemented as an array of arrays (each item in the top-level array is, in itself, an array); a 3-dimensional array is an array of arrays of arrays, etc.; and there is no rule stating that all secondary (etc.) arrays must have the same number of elements.


What do arrays eat?

Arrays are reported to be omnivoire.


Instantiation of objects in c plus plus?

Objects are instantiated when statically declared or dynamically created with the new keyword.


How do you find the difference between two arrays in Java?

for arrays you can list the different arrays and what attributes that you give to them.


Arrays whose size can be altered are known as?

Arrays whose size can be altered are known as dynamic arrays.


What are the types of arrays and syntax?

Arrays can be of following types.