Code problems | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Code problems

#include <iostream> using namespace std; class Array{ public: Array(string* arrCop){ this->arrCol = arrCop; } friend void arrArray(Array& obj); private: string arr[4][4]{0}, arrCol[4][4]{0}; };

13th Aug 2018, 7:58 AM
Oleg Storm
Oleg Storm - avatar
4 Answers
+ 4
I'm not so sure what you are trying to do here, but here's a few points to note: You initialized private members <arr> and <arrCol> with {0} but that's not acceptable, can't initialize with null. Remove the {0}. Your constructor try to assign a string <arrCop> into a multidimensional string array <arrCol>, you need to choose, into which element (in the string array) do you want to insert the <arrCop>. I don't know what to suggest here because I'm not understanding your code intention. Hth, cmiiw
13th Aug 2018, 10:53 AM
Ipang
+ 2
Ipang, thanks without a doubt, it helps a lot👍☺
13th Aug 2018, 11:33 AM
Oleg Storm
Oleg Storm - avatar
+ 1
it says: incompatible type in line this ->arrCol = arrCop; Just want to copy arrCol value to arrCop. Any suggestions?
13th Aug 2018, 7:59 AM
Oleg Storm
Oleg Storm - avatar
+ 1
Oleg Storm You're welcome, glad to help : )
13th Aug 2018, 12:01 PM
Ipang