Is there possible to create an 2-D character array in c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is there possible to create an 2-D character array in c++

C++

13th Jul 2017, 4:22 AM
Akshay chaudhari
Akshay chaudhari - avatar
4 Answers
+ 11
/* I'm not that good in cpp but this is how we do it I guess : */ int main() { char foo[2][3] = {{'a','b','c'}, {'d','e','f'}}; cout<< foo[1][0]; return 0; }
13th Jul 2017, 4:42 AM
Dev
Dev - avatar
+ 5
@Dayve's answer is correct. If it still throws an error on desktop, please post your entire code.
13th Jul 2017, 5:14 AM
Hatsy Rei
Hatsy Rei - avatar
0
I tried it on visual studio 2010 ultimate​ bt it gives me an error...
13th Jul 2017, 4:22 AM
Akshay chaudhari
Akshay chaudhari - avatar
0
Dayve I want to take an input from user and as well as dynamic memory allocation..... please try it....
13th Jul 2017, 1:32 PM
Akshay chaudhari
Akshay chaudhari - avatar