0
How to give to an array the dimensions of two variables?
Good morning, I wrote a code in that read a txt file and gives the value to a variable called node_number. I have to assign to an array the dimension equal to node_number. Could you help me?
5 Respostas
+ 2
I don’t have the code on my phone. But my question is simple. I want to allocate an array with the dimension of a variable previously defined.
+ 2
Giulio Palamà
I don't know how far have you gone through the C++ lesson, just in case you haven't got to the "Dynamic Memory" chapter, where dynamic array allocation is covered, here's the lesson link:
https://www.sololearn.com/learn/CPlusPlus/1632/
+ 1
Hello Giulio Palamà
Can you share your code in the Description section? it would be rather hard for others to help you without looking at the code.
See if you can open this link, it's a guide for sharing content links around SoloLearn.
https://www.sololearn.com/post/74857/?ref=app
+ 1
thanks!!
0
int ArraySize;
cout<<"Enter array Size: ";cin>>ArraySize;
int Array;
Array = new Int[ ArraySize ];
delete [] Array;