динамические-массивы

Initializing a two-dimensional dynamic array

I am trying to initialize all the elements of a two-dimensional array when declaring it: int** ints = new int* [n] { new int ... lays -842150451 -842150451 -842150451 -842150451 -842150451 , and such: int* ints = new int[5] { 0 }; - 0 0 0 0 0 .

Sorting a two-dimensional dynamic array by c++strings

Created a dynamic array in c++, filled it in. Now you need to sort by the first element of the rows. That is, so that the row ... cout << endl; } for (int i = 0; i < rows; i++) { delete[] arr[i]; } delete[] arr; }

Dynamic array of C objects#

There is a class (public class myNum). How do I declare and then initialize a two-dimensional dynamic array with objects of m ... blic MyNum[,] Array1; public MyNum[][] Array1; I don't understand it, and it's not written anywhere about it. As usual!!!

heap corruption detected after normal block c++

A couple of days ago I started learning c++ and ran into this problem. The goal is to write a program to enter numbers and ca ... nAverage << endl; delete[] input; return 0; } Help, please, half of Google searched, did not find a solution.

I can't solve the problem with the c++array

The task itself: In the transformed linear array, find the max and min elements by value, assuming that such elements are the ... n; i++) if(a[i] != 404) cout << a[i] << ' '; cout << '\n'; system("pause"); }

It is not possible to merge two arrays into one there is a heap corruption detected after normal block

I solve this problem: Fill in two arrays A and B with random values. Print first A and then B. Combine A and B into an array ... heap corruption detected after normal block. Maybe I somehow incorrectly eat arrays or incorrectly allocate memory for them?

Why is dynamic memory bad? [closed]

Closed. It is impossible to give an objective answer to this question . Answers to it are not accepted at the moment. ... . the program is in terms of memory and speed. But in many task reviews, I often found advice not to use dynamic memory. Why?

Help me write the sorting of a two-dimensional array by the Shell method to this program so that it sorts as indicated in the image. C++

Thank you in advance program code: #include <iostream> using namespace std; int main() { setlocale(LC_ALL, ... nt j = 0; j < m; j++) cout << matrix[i][j] << " "; cout << endl; } return 0; }

Implementing a dynamic array in Java

Please help me understand the topic of Java dynamic arrays. I need to create a class DynamicArray, which stores an array, a ... , one example of a dynamic array is ArrayList and you need to implement methods like it. Thank you in advance for your help!

Sorting a two-dimensional dynamic array of strings in alphabetical order.

I'm trying to sort the array in alphabetical order. The array will consist of the first name and last name. I tried to fill t ... rintf("%s %s\n", perepis[g].meno1[g], perepis[g].meno2[g]); } return 0; } Please help, thank you all in advance! :)

Comparing two arrays in PHP

I make an online store of contact lenses. Stuck on the implementation of the function of adding an item to the cart with DIFF ... le='width: 50%;float:left;'>"; echo '<b>На выходе</b><br>'; print_r($prodsInCart); echo '</div>';

Passing a dynamic array to a function via a pointer

I've heard that an array can be passed to a function as a pointer. Where can I get this pointer from? And then how to access the elements of the source array through it? Thank you in advance.

Comparing c++arrays

I did not find such a question on the forum. You need to compare two arrays of characters and determine whether one string is ... t; endl; for(int i = 0; i < _size; ++i) for(int j = 0; j<_size; j++) if(tab[i] == tab1[j]) }

How to allocate memory for a 2-dimensional dynamic array

There is such a class: class Field { public: Field(sf::Vector2<int> size); ~Field(); sf::Vector2<int> ... ду } The problem is that I can't allocate a two-dimensional array in the constructor and nothing else, what is the problem?

C. Declaring a dynamic two-dimensional array

I am studying the declaration of two-dimensional dynamic arrays in C. I assumed that dynamic arrays here can only be declared ... I tried elementary: int m, n; scanf("%d %d", &m, &n); int a[m][n]; And it worked. Is this normal? Can I use this?

Output of data from the database to an html table using php

Dear visitors. I have a question. The essence of the situation - it is necessary to output data from the database to a table ... echo "<td class='day'; id='".$id."'> &nbsp; </td>"; // если нет - рисовать пустую клетку } $t++; }

Si, adding and removing stack elements

Task: Write routines for working with the stack. And then a program that just calls these subroutines in turn. I wrote the s ... nt i = 0; i < num; i++) Add(&STACK, l); printf("%d Элементы добавлены"); return; } }

Why do I need dynamic arrays in C++?

C++ textbooks say that dynamic arrays are needed when the size of these arrays is not known in advance. Then there is an expl ... red it already during the execution of the program. So what is the catch, why do you need to do with pointers a as I did not?

Change the size of the array dynamically

For example, there is such an array, how to change its size from 4 to another number? int[] array = new int[4];

How to organize dynamic array creation?

I open the file, read a number that tells us how many arrays we will use. The number will change all the time, so you will not be able to declare a certain number of arrays in advance.