0
Is it possible to have, in an array, in the curly braces, less than the specified integers in the square braces?
Example: a[6]={ 1 , 2 , 3 , 4 }
3 Respostas
+ 4
In case of C/C++, yes you can.
Now the remaining indexes will have 0 inside them.
Please do specify the language.
0
Using an array in c++ is a bit complex. It has been simplified by c++ standard library by using what is called vector.
Vector is an advanced array that is dynamic. It has a lot of advantage over the original array.
As for your question, its possible to have less than the specified integers. Bear in mind that the rest of the integers will be filled with zeros.
int a[6] = {1, 2, 3, 4, 0, 0};