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 }

17th Jul 2019, 5:42 AM
It's *Aandrew* Banu
It's *Aandrew* Banu - avatar
2 Answers
+ 4
In case of C/C++, yes you can. Now the remaining indexes will have 0 inside them. Please do specify the language.
17th Jul 2019, 5:47 AM
blACk sh4d0w
blACk sh4d0w - avatar
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};
17th Jul 2019, 9:39 AM
Franky BrainBox
Franky BrainBox - avatar