c++ arrays | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

c++ arrays

Hi everyone! I want to create a function to set a two dimensional array but I do not want to specify how many rows and columns the array will have. But I can't do it. Take a look: ----------------------------------- void setARR(int arr[][], int size1, int size2) { for (int i = 0; i < size1; i++) { for (int j = 0; j < size2; j++) { int x; cin >> x; arr[i][j] = x; } } } ----------------------------------- What should I do?

30th Oct 2018, 6:21 PM
H2727
H2727 - avatar
2 Answers
+ 2
it's not possible... only last dimensions of multidimensional array can be left blank...
30th Oct 2018, 6:48 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
30th Oct 2018, 7:09 PM
XiLef