+ 1

Array

int A[]={2,3}; int B[]={4,5,6}; int C[]; C=A; A=B; B=C; Does that means C's size is mutable ?

16th Mar 2019, 8:32 AM
Alex
Alex - avatar
4 Respostas
+ 7
I've tested your code in both C and C++. It is impossible to do int C[]; As the compiler tries to deduce the size of C but C was not initialized. It is also impossible to alter or assign an array pointer to another array pointer. C = A; If you need an array of mutable size, try vectors. https://www.sololearn.com/learn/261/?ref=app
16th Mar 2019, 8:45 AM
Fermi
Fermi - avatar
+ 6
It's not possible in Java too.
16th Mar 2019, 8:46 AM
Aaron Stone
Aaron Stone - avatar
+ 4
Thanks Fermi
16th Mar 2019, 8:51 AM
Alex
Alex - avatar
+ 4
Thanks to you too Aaron Stone
16th Mar 2019, 8:51 AM
Alex
Alex - avatar