string array ->char array | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

string array ->char array

Hello, I would like to know how to convert string a[] = {"b", "c"}; into char d[] = {'b', 'c'}? If we have very long array.

6th Jul 2021, 11:13 AM
TeaserCode
5 Answers
+ 1
TeaserCode, Here's one possible way https://code.sololearn.com/c7U3Y0atZqJi/?ref=app
6th Jul 2021, 1:22 PM
Ipang
+ 1
Thanks both of you, it is a basic matter. I haven't known number of col is zero not one.
6th Jul 2021, 5:47 PM
TeaserCode
0
Does anybody knows it?
6th Jul 2021, 11:40 AM
TeaserCode
0
TeaserCode here is a simple way to convert string array a[] to char array d[] as per your requirement. Do take a look at my code https://code.sololearn.com/cA52DuaLP9yk/?ref=app
6th Jul 2021, 1:49 PM
kannan
kannan - avatar
0
TeaserCode, What number of col is zero?
6th Jul 2021, 6:09 PM
Ipang