answersLogoWhite

0

No. Arrays can be defined at runtime, just as they can in C. It's just that it's generally more convenient to use vectors instead of dynamic arrays at runtime, thus arrays are generally used statically, at compile time.

User Avatar

Wiki User

11y ago

What else can I help you with?

Related Questions

What is an array of class objects.how the array of class of class objects is defined in c plus plus?

An array of class objects is just a set of class objects arranged linearly in memory. It is no different than an array of elementary objects. You define it the same way. class myClass { ... }; myClass arrayOfMyClass[100]; // creates 100 objects and fires the constructor 100 times


How arrays must be handled in c plus plus?

If the array is static it can declared in the structure itself: struct myArrayTag { int num[12]; // array of 12 integers (e.g., 48 bytes). } myArray; If it is dynamic then you must use a pointer and allocate the array outside the structure. You should also maintain a variable in the structure to keep track of how many elements the array currently has: struct myBufferTag { int * array; // Pointer to array of integers. int size; // Size of array (number of elements); } myBuffer;


What is the lowest subscript of an array in c plus plus?

The lowest subscript of an array in C, or C++ is 0.


In C plus plus is it possible to instantiate an array without specifying a length?

No. You can declare a dynamic array without specifying a length, but in order to physically instantiate (either by using malloc or by using object-oriented construction) you must provide a length.


What are the importance of integrating xml into c plus plus?

XML is not integrated int C++. If it is then it must be implementation-defined, it is not part of the standard.


How do you declare a string array and add elements to it in C plus plus?

You cannot add elements to a fixed array in C or C++. If, however, the array is declared as a pointer to an array, you can add elements by allocating a new array, copying/adding elements as needed, reassigning the new array to the pointer, and deallocating the original array.


Can you help me with the C plus plus code of the program which has 10 index of array it adds 5 into every even elements of the array and then it subtracts 10 into the odd elements of the array?

int array[10] = {...}; for (int i = 0; i < 10; ++i) { if (i % 2 == 0) array[i] += 5; else array[i] -= 10; }


To find the largest element of an array in c plus plus?

int GetMaxElement( void * array) { if (array != 0) { return(max(array[], typeof(array))); } return(0); }


How do you ignore certain components of an array in C plus plus?

The simplest way is to simply not place those elements in the array in the first place. If that is not possible, then one solution would be to make a single traversal of the array, deciding which elements must be ignored as you go, and building another array of pointers to those elements that must be processed. However, if the decision is a fairly simple one, then you don't need a separate array, you can simply make the decision as you process the array. You're not physically ignoring the elements, you're simply deciding which elements to process. Which method you use ultimately depends on how complex the decision is and whether that decision needs to be remembered for any subsequent traversals or not. But in order to physically ignore an element, the element must be removed from the array, which would require at least one complete traversal to build a new array. It's up to you to determine if it's worthwhile creating a new array or not.


How do you create an array and perform insertion and deletion in this array in C plus plus?

There are two ways to ceate an array.One is static and the other is dynamic. In a static way,when you defined an anrry,you must designate the number of its elements. For example: char a[10].In this way.Its memory location is assigned when it's compiled. In a dynamic way,you can assign the memory location of an array when you need it . You can use the operation of 'new' to asign memory location for an array,and free the memory location by 'delete' operation. For example: char a[];a=new char[10];When we need to free it ,wo just need to do like this :delete[] a; Of course, when we create an array,wo need to insert elments.We can directly gave a string to it,but before that wo must make sure the array is long enough. For example: a="word":(here wo just need to use the name of array) It also can be assigned one-by-one.It means wo can use a circle construct to gave evalution. For example : for(int i=0;i<10;i++) { cin>>a[i]; }


How do you write a program in c plus plus to check if an array is symmetric?

To determine if an array is symmetric, the array must be square. If so, check each element against its transpose. If all elements are equal, the array is symmetric.For a two-dimensional array (a matrix) of order n, the following code will determine if it is symmetric or not:templatebool symmetric(const std::array& matrix){for (size_t r=0 ; r


Array implementation of priority queue example program in c plus plus?

yes