+ 2

C++ Array

Can i store string, char and intigers in same array? If i can then how?it's confusing me. Please help me to get out of this.

6th Aug 2020, 2:20 PM
Raju
Raju - avatar
3 Réponses
+ 2
No, since arr type is declared first so only one type data can be stored
6th Aug 2020, 2:24 PM
Aman Saini
Aman Saini - avatar
+ 1
u can use struct/class/tuple
6th Aug 2020, 2:25 PM
durian
durian - avatar
0
No you can't. This is because the array type is declared at the starting and you can declare the array as only one type. You can learn more in this tutorial https://www.tutorialspoint.com/cplusplus/cpp_arrays.htm
22nd Dec 2023, 6:20 AM
Swadin
Swadin - avatar